Skip to main content
Session.prototype.on - inspector - Node documentation
method Session.prototype.on

Usage in Deno

import { Session } from "node:inspector";
Session.prototype.on(
event: string,
listener: (...args: any[]) => void,
): this

Parameters

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

Return Type

this
Session.prototype.on(
event: "inspectorNotification",
listener: (message: InspectorNotification<object>) => void,
): this

Emitted when any notification from the V8 Inspector is received.

Parameters

event: "inspectorNotification"
listener: (message: InspectorNotification<object>) => void

Return Type

this
Session.prototype.on(
event: "Runtime.executionContextCreated",
): this

Issued when new execution context is created.

Parameters

event: "Runtime.executionContextCreated"

Return Type

this
Session.prototype.on(
event: "Runtime.executionContextDestroyed",
): this

Issued when execution context is destroyed.

Parameters

event: "Runtime.executionContextDestroyed"

Return Type

this
Session.prototype.on(
event: "Runtime.executionContextsCleared",
listener: () => void,
): this

Issued when all executionContexts were cleared in browser

Parameters

event: "Runtime.executionContextsCleared"
listener: () => void

Return Type

this
Session.prototype.on(
event: "Runtime.exceptionThrown",
): this

Issued when exception was thrown and unhandled.

Parameters

event: "Runtime.exceptionThrown"

Return Type

this
Session.prototype.on(
event: "Runtime.exceptionRevoked",
): this

Issued when unhandled exception was revoked.

Parameters

event: "Runtime.exceptionRevoked"

Return Type

this
Session.prototype.on(
event: "Runtime.consoleAPICalled",
): this

Issued when console API was called.

Parameters

event: "Runtime.consoleAPICalled"

Return Type

this
Session.prototype.on(
event: "Runtime.inspectRequested",
): this

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

Parameters

event: "Runtime.inspectRequested"

Return Type

this
Session.prototype.on(
event: "Debugger.scriptParsed",
): this

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

Parameters

event: "Debugger.scriptParsed"

Return Type

this
Session.prototype.on(
event: "Debugger.scriptFailedToParse",
): this

Fired when virtual machine fails to parse the script.

Parameters

event: "Debugger.scriptFailedToParse"

Return Type

this
Session.prototype.on(
event: "Debugger.breakpointResolved",
): this

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

Parameters

event: "Debugger.breakpointResolved"

Return Type

this
Session.prototype.on(
event: "Debugger.paused",
): this

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

Parameters

event: "Debugger.paused"

Return Type

this
Session.prototype.on(
event: "Debugger.resumed",
listener: () => void,
): this

Fired when the virtual machine resumed execution.

Parameters

event: "Debugger.resumed"
listener: () => void

Return Type

this
Session.prototype.on(
event: "Console.messageAdded",
): this

Issued when new console message is added.

Parameters

event: "Console.messageAdded"

Return Type

this
Session.prototype.on(
event: "Profiler.consoleProfileStarted",
): this

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

Parameters

event: "Profiler.consoleProfileStarted"

Return Type

this
Session.prototype.on(
event: "Profiler.consoleProfileFinished",
): this

Parameters

event: "Profiler.consoleProfileFinished"

Return Type

this
Session.prototype.on(
event: "HeapProfiler.addHeapSnapshotChunk",
): this

Parameters

event: "HeapProfiler.addHeapSnapshotChunk"

Return Type

this
Session.prototype.on(
event: "HeapProfiler.resetProfiles",
listener: () => void,
): this

Parameters

event: "HeapProfiler.resetProfiles"
listener: () => void

Return Type

this
Session.prototype.on(
event: "HeapProfiler.reportHeapSnapshotProgress",
): this

Parameters

event: "HeapProfiler.reportHeapSnapshotProgress"

Return Type

this
Session.prototype.on(
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.

Parameters

event: "HeapProfiler.lastSeenObjectId"

Return Type

this
Session.prototype.on(
event: "HeapProfiler.heapStatsUpdate",
): this

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

Parameters

event: "HeapProfiler.heapStatsUpdate"

Return Type

this
Session.prototype.on(
event: "NodeTracing.dataCollected",
): this

Contains an bucket of collected trace events.

Parameters

event: "NodeTracing.dataCollected"

Return Type

this
Session.prototype.on(
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.

Parameters

event: "NodeTracing.tracingComplete"
listener: () => void

Return Type

this
Session.prototype.on(
event: "NodeWorker.attachedToWorker",
): this

Issued when attached to a worker.

Parameters

event: "NodeWorker.attachedToWorker"

Return Type

this
Session.prototype.on(
event: "NodeWorker.detachedFromWorker",
): this

Issued when detached from the worker.

Parameters

event: "NodeWorker.detachedFromWorker"

Return Type

this
Session.prototype.on(
event: "NodeWorker.receivedMessageFromWorker",
): this

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

Parameters

event: "NodeWorker.receivedMessageFromWorker"

Return Type

this
Session.prototype.on(
event: "Network.requestWillBeSent",
): this

Fired when page is about to send HTTP request.

Parameters

event: "Network.requestWillBeSent"

Return Type

this
Session.prototype.on(
event: "Network.responseReceived",
): this

Fired when HTTP response is available.

Parameters

event: "Network.responseReceived"

Return Type

this
Session.prototype.on(
event: "Network.loadingFailed",
): this

Parameters

event: "Network.loadingFailed"

Return Type

this
Session.prototype.on(
event: "Network.loadingFinished",
): this

Parameters

event: "Network.loadingFinished"

Return Type

this
Session.prototype.on(
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.

Parameters

event: "NodeRuntime.waitingForDisconnect"
listener: () => void

Return Type

this
Session.prototype.on(
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

Parameters

event: "NodeRuntime.waitingForDebugger"
listener: () => void

Return Type

this