Synchronous Dispatcher is deprecated!
Synchronous Dispatcher is deprecated. Development is continued in Metamatic package!
This is a synchronous dispatcher that enables you to dispatch application-wide events everywhere in your app and handle them everywhere inside your app. Simple is beautiful - and usually works better as well! This is a framework for no-nonsense fast coding. Just forget all academic theorizations for a second and try it out - You'll notice that this just works. Use it with Angular or React or whatever you like.
npm install synchronous-dispatcher
When you want to dispatch an event somewhere in your app:
And when you want to catch the event:
You can also register a handler under specified ID. It is useful when you want to explicitely remove that handler later:
Note that if you define a new handler for 'MY-EVENT' under same ID 'MANAGER', your new handler will override the previous one. If you want one event to launch many handlers, you must define each handler under different ID!
When you want to kill a certain handler for a certain event, in this case a handler with id 'MANAGER' for 'MY-EVENT':
Heikki Kupiainen / Oppikone
Please visit the blog post for tutorial.