@egeonu/event-driver
v1.0.1
Published
Event subscribing and dispatching manager that allows attaching callbacks, and passing json objects.
Downloads
19
Maintainers
Readme
Event Drive
Event subscribing and dispatching manager that allows attaching callbacks, and passing json objects.
Installation
npm install @egeonu/event-driverUsage
EventDriver
import { EventDriver } from '@egeonu/event-driver';
const event = new EventDriver({action:"test"});
const callback1 = (input: string) => {
console.log("1-" + input);
}
const callback2 = (input: string) => {
console.log("2-" + input);
}
const callback3 = (input: string) => {
console.log("3-" + input);
}
event.subscribe(callback1);
event.subscribe(callback2);
event.subscribe(callback3);
console.log("Starting tests...");
event.invoke("test");Expected output
- Starting tests...
- 1-test
- 2-test
- 3-test
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.
