Tiny, typed signal utility for Node.js and browsers. No dependencies.
Need multiple dynamic events and types? Check out EE (Event Emitter) instead
npm install @soncodi/signal --save
;// specify callback param type;;signal.oncb;signal.emit123;signal.offcb;
Attaches a signal handler to be called whenever the signal fires.
Attaches a one-time handler which is unbound after it fires the first time.
Detaches one instance of a given handler from the signal. If no handler is provided, detaches all handlers.
Fires the signal synchronously, triggering any attached handlers with the given
Fires the signal asynchronously, triggering any attached handlers with the given
arg. Useful when attaching handlers later in the same event loop turn.