Skip to content

Instantly share code, notes, and snippets.

@Unitech
Created May 16, 2014 12:53
Show Gist options
  • Save Unitech/fd9561765bd3bc0d61d1 to your computer and use it in GitHub Desktop.
Save Unitech/fd9561765bd3bc0d61d1 to your computer and use it in GitHub Desktop.
Wrapping functions
function before(fn) {
var ret = null;
return function() {
try {
ret = fn.apply(this, arguments);
} catch(e) {
console.error(e);
}
return ret;
};
}
Object.keys(WatchDog).forEach(function(key) {
if (typeof WatchDog[key] == 'function')
WatchDog[key] = before(WatchDog[key]);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment