Last active
August 29, 2015 13:57
-
-
Save ondrek/9410322 to your computer and use it in GitHub Desktop.
Javascript Bind Native Implementation
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 myFunc = function(){}; | |
myFunc.prototype.bind = function( funct, obj ) { | |
return function(){ | |
return funct.apply( obj, arguments ); | |
}; | |
}; | |
/* | |
Element.addEventListener( "change", this.bind( this.refreshImagePreview, this ) ); | |
no we have an access inside of EventListerner to the this | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment