react-idispatcher

0.0.3 • Public • Published

React Improved Dispatcher

An improved event dispatcher allow listeners to listen to specific events and actions or to global events. You can register three ways:

//all global events
dispatcher.register(function(e) {
    //e.payload
});

//all foo events
dispatcher.register('foo', function(e) {
    //e.payload
});

//any foo event with create action
dispatcher.register('foo', 'create', function(e) {
    //e.payload
});

To dispatch an event, you can dispatch via:

dispatcher.dispatch('foo', 'create', {
    bar : 'baz'
});

Package Sidebar

Install

npm i react-idispatcher

Weekly Downloads

4

Version

0.0.3

License

MIT

Last publish

Collaborators

  • mitchellsimoens-user