Skip to content

Instantly share code, notes, and snippets.

@KoryNunn
Last active November 3, 2017 01:30
Show Gist options
  • Save KoryNunn/5c6cb954a6d9be930d2a9b873cc34797 to your computer and use it in GitHub Desktop.
Save KoryNunn/5c6cb954a6d9be930d2a9b873cc34797 to your computer and use it in GitHub Desktop.
prototypical method binding Proxy
function bindContext(object){
return new Proxy({
get: function(target, key){
if(typeof target[key] === 'function' && !target.hasOwnProperty(key)){
return target[key].bind(target);
}
return target[key];
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment