method
inspector.Session.emit
Synchronously calls each of the listeners registered for the event named eventName, in the order they were registered, passing the supplied arguments to each.
Returns true if the event had listeners, false otherwise.
import { EventEmitter } from 'node:events';
const myEmitter = new EventEmitter();
// First listener
myEmitter.on('event', function firstListener() {
console.log('Helloooo! first listener');
});
// Second listener
myEmitter.on('event', function secondListener(arg1, arg2) {
console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
});
// Third listener
myEmitter.on('event', function thirdListener(...args) {
const parameters = args.join(', ');
console.log(`event with parameters ${parameters} in third listener`);
});
console.log(myEmitter.listeners('event'));
myEmitter.emit('event', 1, 2, 3, 4, 5);
// Prints:
// [
// [Function: firstListener],
// [Function: secondListener],
// [Function: thirdListener]
// ]
// Helloooo! first listener
// event with parameters 1, 2 in second listener
// event with parameters 1, 2, 3, 4, 5 in third listenerReferenced types
interface InspectorNotification<T>
interface ExecutionContextCreatedEventDataType
interface ExecutionContextDestroyedEventDataType
interface ExceptionThrownEventDataType
interface ExceptionRevokedEventDataType
interface ConsoleAPICalledEventDataType
- context?: string
Console context descriptor for calls on non-default console context (not console.*): 'anonymous#unique-logger-id' for call on unnamed context, 'name#unique-logger-id' for call on named context.
interface InspectRequestedEventDataType
interface ScriptParsedEventDataType
- stackTrace?: StackTrace
JavaScript top stack frame of where the script parsed event was triggered if available.
interface ScriptFailedToParseEventDataType
- stackTrace?: StackTrace
JavaScript top stack frame of where the script parsed event was triggered if available.
interface BreakpointResolvedEventDataType
interface PausedEventDataType
- asyncCallStackTraceId?: StackTraceId
Just scheduled async call will have this stack trace as parent stack during async execution. This field is available only after <code>Debugger.stepInto</code> call with <code>breakOnAsynCall</code> flag.
interface MessageAddedEventDataType
interface ConsoleProfileStartedEventDataType
interface AddHeapSnapshotChunkEventDataType
interface ReportHeapSnapshotProgressEventDataType
interface LastSeenObjectIdEventDataType
interface HeapStatsUpdateEventDataType
- statsUpdate: number[]
An array of triplets. Each triplet describes a fragment. The first integer is the fragment index, the second integer is a total count of objects for the fragment, the third integer is a total size of the objects for the fragment.
interface LoadingFailedEventDataType
interface LoadingFinishedEventDataType
interface DataReceivedEventDataType
- encodedDataLength: number
Actual bytes received (might be less than dataLength for compressed encodings).