1.0.1 • Published 1 year ago

@nico78916/event_manager v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Event Manager

A simple event manager which have 3 functions :

  1. on(event : string,listener : function) : attach the listener to the provided event name/id
  2. fire(event : string, data : any) : Trigger the event and send date with it
  3. off(event : name, listener : function) : detach the listener from the event given

Exemple

const EventManager = require("@nico78916/event_manager");

function helloWorld(data){
    console.log(data);
}

EventManager.on("Event",helloWorld);
EventManager.fire("Event","Hello world!");//Output : Hello world!
EventManager.off("Event",helloWorld);
EventManager.fire("Event","Hello world!");//No output
1.0.1

1 year ago

1.0.0

1 year ago