Skip to content

fmarcoccia/publisher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

publisher

micro library to subscribe and emit a custom event

Examples

Basic example

// add subscriber to listen event with name EVENT_1
const firstSubscriber = publisher.subscribe('EVENT_1', (data) => {
    console.log('recive data from EVENT_1 --> ', data)
});

// emit event to all subscriber to EVENT_1
publisher.emit('EVENT_1', 'hello subscriber');

// Deregister event
firstSubscriber();

About

micro library to subscribe and emit a custom event

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors