1.0.0 • Published 7 years ago

@legworkstudio/eventful v1.0.0

Weekly downloads
1
License
MIT
Repository
-
Last release
7 years ago

Eventful

A helper class for events.

Build Status

Use

Listen:

_myObject.on('some-event', (event) => console.log(event) );

Trigger:

_myObject.trigger('some-event', {foo: bar, fizz: buzz, data: {} }); _myObject.trigger('some-other-event');

Detach:

_myObject.off('some-event');

With Eventful you can attach listeners to any object that you have access to and transfer data between the caller and the object.

Returns

Will return an object with the event and any data associate with that event.

Methods

on('event-type'): Attach an event (string) off('event-type'): Detaches an event that has been attached (string) trigger('event-type', {}): Triggers an event (string, data)

Tests

To run tests npm test

1.0.0

7 years ago