abstract class CoordinatedLifecycle<
TPhase extends number,
TEvents extends SEEventMapLike<TEvents>
> extends StrictEventEmitter<TEvents>abstract class CoordinatedLifecycle<
TPhase extends number,
TEvents extends SEEventMapLike<TEvents>
> extends StrictEventEmitter<TEvents>Member visibility
Filter class members by access level.
Showing members with Protected visibility and higher.
TPhase
TEvents
TEvents extends SEEventMapLike<TEvents>TEvents extends SEEventMapLike<TEvents>protected readonly phaseOrder: TPhase[]protected readonly phaseOrder: TPhase[]protected readonly tasksMap: Map<TPhase, LifecycleTask[]>protected readonly tasksMap: Map<TPhase, LifecycleTask[]>addListener()
Alias of onon for compatibility with Node.js EventEmitter APIs.
eventThe event name to attach to
listenerCallback operating on the typed argument tuple for the event
Inherited from:StrictEventEmitter
phaseThe lifecycle phase to add the task to
taskNameUnique name for the task (used for logging and removal)
taskAsync function to execute during the phase
timeoutMsMaximum time allowed for task execution in milliseconds
emit()
Emits an event with the strictly typed argument tuple for the event name.
eventThe event name to emit
argsTuple payload for the event
Inherited from:StrictEventEmitter
eventNamesTyped()
Returns the list of event names known to the emitter with the mapped key type.
eventNamesTyped(): SEEventKey<TEvents>[]eventNamesTyped(): SEEventKey<TEvents>[]Inherited from:StrictEventEmitter
protected abstract async executeTasksInPhase(
phase: TPhase,
tasks: LifecycleTask[]
): Promise<PromiseSettledResult<void>[]>protected abstract async executeTasksInPhase(
phase: TPhase,
tasks: LifecycleTask[]
): Promise<PromiseSettledResult<void>[]>listenerCountTyped()
Counts listeners for an event without widening the return type of listenerCountlistenerCount.
eventThe event name to inspect
Inherited from:StrictEventEmitter
listeners()
Retrieves the listener list for a given event with the correct tuple signature.
eventThe event name to inspect
Inherited from:StrictEventEmitter
off()
Removes a previously registered listener for the given event.
eventThe event name whose listener should be removed
listenerCallback originally registered for the event
Inherited from:StrictEventEmitter
on()
Registers a persistent listener with tuple-safe arguments for the given event.
eventThe event name to attach to
listenerCallback operating on the typed argument tuple for the event
Inherited from:StrictEventEmitter
once()
Registers a one time listener that is removed after the first invocation.
eventThe event name to attach to
listenerCallback operating on the typed argument tuple for the event
Inherited from:StrictEventEmitter
removeListener()
Alias of offoff for compatibility with Node.js EventEmitter APIs.
eventThe event name whose listener should be removed
listenerCallback originally registered for the event
Inherited from:StrictEventEmitter
protected async runTaskWithTimeout(
phase: TPhase,
task: LifecycleTask
): Promise<void>protected async runTaskWithTimeout(
phase: TPhase,
task: LifecycleTask
): Promise<void>waitFor()
Waits for an event to be emitted, resolving with the listener arguments tuple once triggered. Supports optional abort signals and timeouts for cancellation semantics.
async waitFor<TEventKey>(
event: TEventKey,
opts?: { signal?: AbortSignal; timeoutMs?: number }
): Promise<TEvents[TEventKey]>async waitFor<TEventKey>(
event: TEventKey,
opts?: { signal?: AbortSignal; timeoutMs?: number }
): Promise<TEvents[TEventKey]>eventThe event name to wait for
optsOptional abort signal or timeout in milliseconds
Inherited from:StrictEventEmitter