javscript monitoring function call