// begin signals
this.loginSignal
this.init = function(){
// init signals
this.loginSignal = new t.store.helpers.Signal;
// map events
$('[value]="login"', this.node).click(this.login)
}
this.login = function(){
// this will dispatch an event that will be catched by the controller
// but this is not refering to this class
// and the next line fails :s
this.loginSignal.dispatch();
}
to make it work now i must add
var $this = this;
this line and use $this
instead of this
:S
any clearer way around?
thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…