azu/material-flux

dispatch(key, payload) : key should not object

Opened this issue · 0 comments

azu commented

dispatch(eventKey, ...args) {
this.dispatcher.dispatch({
eventKey,
args
});
this.emit('dispatch', {eventKey, args});
}

    dispatch(eventKey, ...args) {
        this.dispatcher.dispatch({
            eventKey,
            args
        });
        this.emit('dispatch', {eventKey, args});
    }

eventKey should be string | Symbol like object's key.
if eventKey is typeof object, assert this as error.

dispatch({
    type : "HANDLE_SOME",
    data : "data"
});
// throw error

It aim to prevent confusion of usage with other flux library like Redux, Facebook's flux etc...

I'v met similar issue on fluxible's Action.