Add the power of Signals to your projects. They are the most bare bones implementation of an event.
npm install ste-signals


typescript
let clock = new Clock("Smu", 1000);//log the ticks to the console - this is a signal event
clock.onTick.subscribe(() => console.log("Tick!"));
`$3
So let's look at the implementation from a TypeScript perspective. (Do you program NodeJs without typescript? Check this)`typescript
import { SignalDispatcher } from "ste-signals";class Clock {
private _onTick = new SignalDispatcher();
private _ticks: number = 0;
constructor(public name: string, timeout: number) {
setInterval(() => {
this._ticks += 1;
this._onTick.dispatch();
}, timeout);
}
public get onTick() {
return this._onTick.asEvent();
}
}
``Check the documentation or the examples for more information.
Need more info? Check the repo.