0

イベントを発生させたハンドラーを見つける方法はありますか?

たとえば、私の店:

handlers: {
        surahReceived(payload) {
            this._surah = payload.surah;
            this.emitChange();
        },
        ayahsReceived(payload) {
            this.dispatcher.waitFor('AyahStore', function() {
                this._surah.ayahs = this.dispatcher.getStore(AyahStore).getAyahs();
            }.bind(this));
            this.emitChange();
        },
        surahListReceived(payload) {
            this._surahs = payload.surahs;
            this.emitChange();
        }
    }

最後の関数が起動すると、リスナーは次のようになります。

statics: {
        storeListeners: {
            _onSurahReceived: [SurahStore]
        }
    },

イベントを発生させた関数を知りたい

4

1 に答える 1

1

私はこれに対する答えを見つけました:

に引数を渡すことができますemitChange

例えば:

surahListReceived(payload) {
            this._surahs = payload.surahs;
            this.emitChange(1);
        }

次に、あなたの見解で:

statics: {
        storeListeners: {
            _onSurahReceived: [SurahStore]
        }
    },
_onSurahReceived: function(e) {
  console.log(e) // Should be 1
}
于 2015-03-14T00:47:55.460 に答える