2.0.0-beta5 • Published 7 years ago

gremlins-dispatcher v2.0.0-beta5

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

gremlins-dispatcher

gremlin.js dispatcher mixin. Easy component interoperability.

Installation

requires gremlins@1.1.x

NPM

$ npm install gremlins-dispatcher

Usage

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.
2.0.0-beta5

7 years ago

2.0.0-beta4

7 years ago

2.0.0-beta3

7 years ago

2.0.0-beta2

7 years ago

2.0.0-beta1

7 years ago

2.0.0-rc1

7 years ago

1.1.1

7 years ago

1.1.0

8 years ago

1.0.0

8 years ago

1.0.0-rc.2

8 years ago

1.0.0-rc.1

8 years ago

0.6.1

9 years ago

0.6.0

9 years ago

0.5.0

9 years ago

0.4.3

9 years ago

0.4.2

9 years ago

0.4.1

9 years ago