import { EventEmitter } from "node:events";
const events = new EventEmitter();
events.once("ready", (value) => console.log(value));
events.emit("ready", 42);Verified Elide 1.5.0 behavior includes ordered synchronous listener calls,
one-shot listeners, listener removal, newListener and removeListener
notifications, maximum-listener warnings, and throwing an unhandled error
event.
The module includes:
EventEmitter,once,on, andlistenerCountgetEventListeners,getMaxListeners, andsetMaxListenersaddAbortListener,errorMonitor, andcaptureRejectionSymbolEventEmitterAsyncResource
The exported once(emitter, name, { signal }) rejects with AbortError when
the signal aborts, including after the Promise is created.
The captureRejections constructor option is accepted. In Elide 1.5.0,
rejected Promises from async listeners are not consistently redirected to
error.
See the Node.js events documentation for the standard method signatures.