@istanbul/events
v0.0.7
Published
Events package of istanbul framework
Downloads
48
Maintainers
Readme
What Is It?
Server Side Event Package. Do you want to do something in customer service when there is a record in the product table? That's called lifecycle and @istanbul/events provides it.
You don't have to use istanbul framework, @istanbul/events is a nodejs package.
Installation
npm install @istanbul/eventsor with yarn
yarn add @istanbul/events
Example
Take a look at the example folder for example usage!
Basic Usage
import { createEvent } from "@istanbul/events";
let totalPrice = 0;
const callback = (price : number) : void => {
totalPrice += price;
}
const onProductAddEvent = createEvent<number>("product-add");
onProductAddEvent.addListener(callback);
onProductAddEvent.publish(10);
onProductAddEvent.publish(20);
console.log(totalPrice); // 30Although this explains the usage, the purpose of the package is more than that, please review the example folder for better usage.
