0.0.8 • Published 7 years ago
rkgttr-publisher v0.0.8
rkgttr-publisher
Based on event-pubsub, a custom events publisher.
How to Install
$ npm install rkgttr-publisher --save-dev
or
$ yarn add rkgttr-publisher --dev
Getting Started
Publisher static methods
on
: will bind the handler function to the the type event. Just like addEventListener in the browser, takes 2 parameters:type
: a string representing the event.callback
: a method you want to invoke when this type of event is triggered.
off
: will unbind the handler function from the the type event. If the handler is "*", all handlers for the event type will be removed, takes 2 parameters:type
: a string representing the event.callback
: a method you want to remove when this type of event is triggered, or*
if you want to remove all event handlers for this event.
trigger
: will call all handler functions bound to the event type and pass all...data
arguments to those handlers:type
: a string representing the event....data
: Arguments to send when triggering the event.
License
MIT © 2016 Erik Guittiere