JsDebugEvent Struct

A statement that is about to run, given to the methods of JsDebugger.

public readonly struct JsDebugEvent

Properties

NameDescription
CallDepthGets the number of JavaScript frames on the stack, the frame of the statement included (1 for the top-level code of a script). A debugger compares it to step over (the next statement with a depth less than or equal) or out of a function (a smaller depth).
EngineGets the engine that runs the statement.
FunctionNameGets the name of the function that contains the statement, or null for the top-level code and the anonymous functions.
LocationGets the position of the start of the statement.
RealmGets the realm of the code of the statement.

CallDepth

JsDebugger.cs

Gets the number of JavaScript frames on the stack, the frame of the statement included (1 for the top-level code of a script). A debugger compares it to step over (the next statement with a depth less than or equal) or out of a function (a smaller depth).

public int CallDepth { get; }

Property value

int

Gets the engine that runs the statement.

public JsEngine Engine { get; }

Property value

JsEngine

FunctionName

JsDebugger.cs

Gets the name of the function that contains the statement, or null for the top-level code and the anonymous functions.

public string? FunctionName { get; }

Property value

string?

Gets the position of the start of the statement.

public JsSourceLocation Location { get; }

Property value

JsSourceLocation

Gets the realm of the code of the statement.

public JsRealm Realm { get; }

Property value

JsRealm

Methods

NameDescription
CaptureStackTrace()Captures the stack trace of the running code, in the format of the stack property of the errors (without the first line).
Evaluate(string)Evaluates code at the position of the statement, like a direct eval: it reads and changes the variables of the statement.
GetCallStack()Gets the JavaScript frames of the stack, the frame of the statement first, then its callers.
GetScopes()Gets the scopes of the statement, the innermost first: its variables, and the ones of the enclosing blocks, functions and global scope.

CaptureStackTrace()

JsDebugger.cs

Captures the stack trace of the running code, in the format of the stack property of the errors (without the first line).

public string CaptureStackTrace()

Returns

string

Evaluate(string)

JsDebugger.cs

Evaluates code at the position of the statement, like a direct eval: it reads and changes the variables of the statement.

public JsValue Evaluate(string code)

Parameters

code string
The code, e.g. an expression.

Returns

JsValue The completion value of the code.

Exceptions

InvalidOperationException
The callback that received the event returned.
JsException
The code throws, or it has a syntax error.

GetCallStack()

JsDebugger.cs

Gets the JavaScript frames of the stack, the frame of the statement first, then its callers.

public IReadOnlyList<JsDebugFrame> GetCallStack()

Returns

IReadOnlyList<JsDebugFrame> The frames. They can be used until the callback that received the event returns.

Exceptions

InvalidOperationException
The callback that received the event returned.

GetScopes()

JsDebugger.cs

Gets the scopes of the statement, the innermost first: its variables, and the ones of the enclosing blocks, functions and global scope.

public IReadOnlyList<JsDebugScope> GetScopes()

Returns

IReadOnlyList<JsDebugScope>

Exceptions

InvalidOperationException
The callback that received the event returned.