Skip to content

balooval/event

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

event

Simple es6 event

Usage

Setup

import Event from 'event.js';

const myEvent = new Event();

Subscribe to an event :

myEvent.addEventListener('WANTED_EVENT_NAME', myListener, myListener.onEventMethod);

Fire an event :

const optionalParam = 'someValue;
myEvent.fireEvent('WANTED_EVENT_NAME', optionalParam);

Unsubscribe to an event :

myEvent.removeEventListener('WANTED_EVENT_NAME', myListener, myListener.onEventMethod);

myListener can be any type of object who has some method to pass to the event.

About

SImple es6 event

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published