public
Last active

  • Download Gist
gistfile1.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
var _that = this;
jQuery.extend({
someFunction: function(onSomeEvent) {
var variable = 'some text';
onSomeEvent.apply(_that); // how to pass current scope variables/functions to this function?
return null;
 
function _someMethod(arg) {
console.log(arg);
}
}
});
 
jQuery.someFunction(function(){
console.log(this.variable); // or console.log(variable);
console.log(this._someMethod(1)); // or jQuery.someFunction._someMethod(2);
});

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.