1.0.4 • Published 4 years ago

publish-subscribe-event v1.0.4

Weekly downloads
4
License
ISC
Repository
github
Last release
4 years ago

NPM version

publish-subscribe-event

Install

# with npm 
$ npm install --save publish-subscribe-event

# with yarn 
$ yarn add publish-subscribe-event --save

Example

import Event from "publish-subscribe-event";

const eventInstance = Event.getInstance();

//  create receive event data
function recData(params) {
    console.log(params);
}

// add new event "my-message"
eventInstance.addEvent("my-message", recData);

// publish "my-message" event and params data
eventInstance.dispatchEvent("my-message", "your params...");


eventInstance.removeEvent("my-message", getData);
eventInstance.removeEventAll();
1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago