gremlins-dispatcher
v2.0.0-beta5
Published
gremlin.js dispatcher mixin. Easy component interoperability.
Downloads
13
Readme
gremlins-dispatcher
gremlin.js dispatcher mixin. Easy component interoperability.
Installation
requires [email protected]
NPM
$ npm install gremlins-dispatcherUsage
At the moment, all listeners will be called, even if the component is not added to the visual dom
<listener-gremlin>
</listener-gremlin>
<dispatcher-gremlin>
</dispatcher-gremlin>const gremlins = require('gremlins');
const dispatcher = require('gremlins-dispatcher');
gremlins.create('listener-gremlin', {
mixins: [dispatcher],
getListeners(){
return {
'FOO': 'onFoo'
};
},
onFoo(data) {
console.log(data.foo);
}
});
gremlins.create('dispatcher-gremlin', {
mixins: [dispatcher],
...
someAction(){
this.emit('FOO', {
foo: 'foo'
});
}
});TODO
- add some sort of queue to have a consistent state across all components, even if they are not created yet.
