Skip to content

Instantly share code, notes, and snippets.

@rohozhnikoff
Created October 5, 2013 01:59
Show Gist options
  • Save rohozhnikoff/6835679 to your computer and use it in GitHub Desktop.
Save rohozhnikoff/6835679 to your computer and use it in GitHub Desktop.
удобный метод для проброса всяких jquery колбеков
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