Skip to content

skarankevich/event-dispatcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Event Dispatcher

Install

$ bower install event-dispatcher

Init

var dispatcher = new EventDispatcher();

API

subscribe

dispatcher.subscribe(event, callback);

dispatcher.subscribe('person:name_updated', function (name, surname) {
    console.log('Now you can call me ' + name + ' ' + surname);
});

trigger

dispatcher.trigger(event, [arg1, arg2, ...]);

dispatcher.trigger('person:name_updated', 'Walter', 'White');

unsubscribe

dispatcher.unsubscribe(event);

dispatcher.unsubscribe('person:name_updated');

About

JavaScript Event Dispatcher

Resources

Stars

Watchers

Forks

Packages

No packages published