There are some function, thats do something long work and its provides callback.
someFunc: function(argument, callback, context) {
// do something long
// call callback function
callback(context);
}
In application I use this function
someFunc('bla-bla', function (context) {
// do something with this scope
context.anotherFunc();
}, this);
How to implement callback function without passing context
parameter?
Need some like this:
someFunc('bla-bla', function () {
// do something with this scope
this.anotherFunc();
}, this);
this
value. So the question is how to achieve the last code block... getting the properthis
in the callback so it doesn't need to be passed as an argument. – Indefectible