dojo deferred を使用した次のコードに似た問題が発生しています:-
これは XXX.js ファイルです
dojo.declare('XXX', [dijit._Widget, dijit._Templated], {
postCreate: function() {
//getting deferred from somewhere
var _this = this;
deferred.then(function(response) {
console.log("This is getting printed");
_this.watch("value", function(A, B, C) {
console.log("This is not getting printed");
var value = _this.get("value");
_this.onValueChange(value);
});
}
私は次のコードでこのクラスフォームの他のJSファイルを呼び出します:-
this.object = new XXX({
//some args
}
dojo.connect(this.object, "onValueChange", function(value) {
console.log("I am here");
this.onValueChange(value);
});
deferred.thenなしで同じ「watch」を使用していたときは、完全に正常に機能していましたが、フォームの値を変更すると関数が実行されません。ポインタはありますか?「this.object」が作成されたときに、遅延オブジェクトが「then」で関数を実行しなかったことが原因でしょうか?