Skip to content

Instantly share code, notes, and snippets.

@AMorgaut
Last active January 3, 2016 03:29
Show Gist options
  • Save AMorgaut/8402379 to your computer and use it in GitHub Desktop.
Save AMorgaut/8402379 to your computer and use it in GitHub Desktop.
method hook on instanciated object
function sayHook = function () {
// do some stuff
// call original say() method
return Object.getPrototypeOf(this).say.apply(this, Array.prototype.slice.call(arguments, 1));
}
obj.say = sayHook;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment