Skip to content

Instantly share code, notes, and snippets.

@fmnoise
Forked from cowboy/unbind.js
Created December 27, 2017 11:17
Show Gist options
  • Save fmnoise/c3ff7c31410e63a476e810922da6b29a to your computer and use it in GitHub Desktop.
Save fmnoise/c3ff7c31410e63a476e810922da6b29a to your computer and use it in GitHub Desktop.
JavaScript: Function.prototype.unbind (for @jugglinmike)
Function.prototype.bind = (function(origBind) {
return function() {
var fn = origBind.apply(this, arguments);
fn.__origFn__ = this.__origFn__ || this;
return fn;
};
}(Function.prototype.bind));
Function.prototype.unbind = function() {
return this.__origFn__;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment