MprependOnceListener
Bun

method

inspector.Session.prependOnceListener

event: string,
listener: (...args: any[]) => void
): this;

Adds a one-timelistener function for the event named eventName to the beginning of the listeners array. The next time eventName is triggered, this listener is removed, and then invoked.

server.prependOnceListener('connection', (stream) => {
  console.log('Ah, we have our first user!');
});

Returns a reference to the EventEmitter, so that calls can be chained.

@param event

The name of the event.

@param listener

The callback function

event: 'inspectorNotification',
listener: (message: InspectorNotification<object>) => void
): this;

Emitted when any notification from the V8 Inspector is received.

event: 'Runtime.executionContextCreated',
): this;

Issued when new execution context is created.

event: 'Runtime.executionContextDestroyed',
): this;

Issued when execution context is destroyed.

event: 'Runtime.executionContextsCleared',
listener: () => void
): this;

Issued when all executionContexts were cleared in browser

event: 'Runtime.exceptionThrown',
): this;

Issued when exception was thrown and unhandled.

event: 'Runtime.exceptionRevoked',
): this;

Issued when unhandled exception was revoked.

event: 'Runtime.consoleAPICalled',
): this;

Issued when console API was called.

event: 'Runtime.inspectRequested',
): this;

Issued when object should be inspected (for example, as a result of inspect() command line API call).

event: 'Debugger.scriptParsed',
listener: (message: InspectorNotification<ScriptParsedEventDataType>) => void
): this;

Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger.

event: 'Debugger.scriptFailedToParse',
): this;

Fired when virtual machine fails to parse the script.

event: 'Debugger.breakpointResolved',
): this;

Fired when breakpoint is resolved to an actual script and location.

event: 'Debugger.paused',
listener: (message: InspectorNotification<PausedEventDataType>) => void
): this;

Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria.

event: 'Debugger.resumed',
listener: () => void
): this;

Fired when the virtual machine resumed execution.

event: 'Console.messageAdded',
listener: (message: InspectorNotification<MessageAddedEventDataType>) => void
): this;

Issued when new console message is added.

event: 'Profiler.consoleProfileStarted',
): this;

Sent when new profile recording is started using console.profile() call.

event: 'Profiler.consoleProfileFinished',
): this;
event: 'HeapProfiler.addHeapSnapshotChunk',
): this;
event: 'HeapProfiler.resetProfiles',
listener: () => void
): this;
event: 'HeapProfiler.reportHeapSnapshotProgress',
): this;
event: 'HeapProfiler.lastSeenObjectId',
): this;

If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event.

event: 'HeapProfiler.heapStatsUpdate',
): this;

If heap objects tracking has been started then backend may send update for one or more fragments

event: 'NodeTracing.dataCollected',
): this;

Contains an bucket of collected trace events.

event: 'NodeTracing.tracingComplete',
listener: () => void
): this;

Signals that tracing is stopped and there is no trace buffers pending flush, all data were delivered via dataCollected events.

event: 'NodeWorker.attachedToWorker',
): this;

Issued when attached to a worker.

event: 'NodeWorker.detachedFromWorker',
): this;

Issued when detached from the worker.

event: 'NodeWorker.receivedMessageFromWorker',
): this;

Notifies about a new protocol message received from the session (session ID is provided in attachedToWorker notification).

event: 'Network.requestWillBeSent',
): this;

Fired when page is about to send HTTP request.

event: 'Network.responseReceived',
): this;

Fired when HTTP response is available.

event: 'Network.loadingFailed',
): this;
event: 'Network.loadingFinished',
): this;
event: 'Network.dataReceived',
listener: (message: InspectorNotification<DataReceivedEventDataType>) => void
): this;

Fired when data chunk was received over the network.

event: 'NodeRuntime.waitingForDisconnect',
listener: () => void
): this;

This event is fired instead of Runtime.executionContextDestroyed when enabled. It is fired when the Node process finished all code execution and is waiting for all frontends to disconnect.

event: 'NodeRuntime.waitingForDebugger',
listener: () => void
): this;

This event is fired when the runtime is waiting for the debugger. For example, when inspector.waitingForDebugger is called

event: 'Target.targetCreated',
): this;
event: 'Target.attachedToTarget',
): this;