Created
October 5, 2013 01:59
-
-
Save rohozhnikoff/6835679 to your computer and use it in GitHub Desktop.
удобный метод для проброса всяких jquery колбеков
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
callback: function (method) { | |
var self = this; | |
return (typeof self[method] === "function") | |
? function(){ | |
// добавляем оригинальный this последним аргументом | |
var args = _(arguments).toArray().value(); | |
args.push(this); | |
return self[method].apply(self, args); | |
} | |
: null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment