任何线索此错误消息可能意味着什么(与调度员有关)

时间:2015-03-13 06:43:36

标签: javascript reactjs

由于某些原因,我似乎无法找到以下错误的确切来源:"TypeError: this.$Dispatcher_callbacks is undefined"

我知道这个错误与我店里的Event Emitter有关,但我甚至没有丝毫的线索如何解决它

var appStore = Assign({}, EventEmitter.prototype, {
    emitChange: function(){
        this.emit(CHANGE_EVENT);
    },
    addChangeListener: function(callback){
        this.on(CHANGE_EVENT, callback);
    },
    removeChangeListener: function(callback){
        this.removeListener(CHANGE_EVENT,callback);
    },
    getCart: function(){
        return cart; 
    },
    getCatalog: function(){
        return catalog;
    },
    // I suspect that the error lies somewhere below
    dispatcherIndex: AppDispatcher.register(function(payload){

        var action = payload.action; 

        switch(action.actionType){
          case Constants.ADD_ITEM:
            API.addItem(payload.action.item);
            break;

          case Constants.REMOVE_ITEM:
            API.removeItem(payload.action.index);
            break;

          case Constants.INCREASE_ITEM:
            API.increaseItem(payload.action.index);
            break;

          case Constants.DECREASE_ITEM:
            API.decreaseItem(payload.action.index);
            break;
        }

        AppDispatcher.emitChange();

        return true;
    })
});

任何线索都将非常感激。

0 个答案:

没有答案