Skip to content

Instantly share code, notes, and snippets.

@ryanwebjackson
Created January 8, 2017 21:37
Show Gist options
  • Save ryanwebjackson/a25f5d955cdd25fa9201e86974aa44de to your computer and use it in GitHub Desktop.
Save ryanwebjackson/a25f5d955cdd25fa9201e86974aa44de to your computer and use it in GitHub Desktop.
(function(thing, doAdditionalStuff) {
var originalMethod = thing.method;
thing.method = function() {
doAdditionalStuff();
return originalMethod.apply(this, arguments);
};
})(thingObject, doAdditionalStuffFunction);
//Calling out dependencies.
//Might also be nice to pass in name of method to modify, if wrapper function stays in place.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment