Last active
December 11, 2015 21:08
-
-
Save toreholmberg/4660000 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; | |
| // usage | |
| $('selector').click(__bind(this.handler, this)); | |
| // or | |
| this.handler = __bind(this.handler, this); | |
| $('selector').click(this.handler, this); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment