, . , , , , "this", . Javascript 'this'. "var me = this" .
function doSomething() {
var me = this;
callSomethingAsynchronous(42, function (result) {
me.theResult = result;
});
}
, , Ext, , .
callSomethingAsynchronous(42, me.handlerFunction, me);
handlerFunction , . - , ,
function sayHelloInAContrivedWay (name) {
getTheGreetingAsync(function (greeting) {
console.log(greeting + name);
});
}
"var me = this" , . minifier . , var
function keepInnerWombatFit () {
var me = this,
wombat = me.inner.wombat;
wombat.run();
wombat.jump();
wombat.sitDown();
me.excerciseCount++;
}
, , ( ) , , , .
this.inner.wombat.run();
this.inner.wombat.jump();
this.inner.wombat.sitDown();