GitHunt
ME

menewman/spy-master

SpyMaster - wraps each function on an object and logs when that function is called

SpyMaster

This is a simple utility to wrap each function on an object and log when that function is called.

To use this function, simply call SpyMaster.infiltrate:

SpyMaster.infiltrate(obj, tag);

Use the infiltrate method to wrap each function of an instance and its immediate prototype. (Note that this won't work well if you're using inheritance and need to spy on methods more than one layer deep in the prototype chain.) Pass the object to be infiltrated as the first parameter, and optionally pass a tag that will used as a prefix when logging function calls to the console.

Languages

JavaScript100.0%

Contributors

MIT License
Created August 26, 2016
Updated August 26, 2016