method Session.prototype.post
Unstable
Usage in Deno
```typescript import { Session } from "node:node__inspector.d.ts"; ```
Session.prototype.post(method: string,callback?: (err: Error | null,params?: object,) => void,): void
Posts a message to the inspector back-end. `callback` will be notified when
a response is received. `callback` is a function that accepts two optional
arguments: error and message-specific result.
```js
session.post('Runtime.evaluate', { expression: '2 + 2' },
(error, { result }) => console.log(result));
// Output: { type: 'number', value: 4, description: '4' }
```
The latest version of the V8 inspector protocol is published on the
[Chrome DevTools Protocol Viewer](https://chromedevtools.github.io/devtools-protocol/v8/).
Node.js inspector supports all the Chrome DevTools Protocol domains declared
by V8. Chrome DevTools Protocol domain provides an interface for interacting
with one of the runtime agents used to inspect the application state and listen
to the run-time events.
void
Session.prototype.post(method: string,params?: object,callback?: (err: Error | null,params?: object,) => void,): void
Session.prototype.post(method: "Schema.getDomains",callback?: (err: Error | null,params: Schema.GetDomainsReturnType,) => void,): void
Returns supported domains.
optional
callback: (err: Error | null,params: Schema.GetDomainsReturnType,) => void
void
Session.prototype.post(method: "Runtime.evaluate",params?: Runtime.EvaluateParameterType,callback?: (err: Error | null,params: Runtime.EvaluateReturnType,) => void,): void
Evaluates expression on global object.
optional
params: Runtime.EvaluateParameterType
optional
callback: (err: Error | null,params: Runtime.EvaluateReturnType,) => void
void
Session.prototype.post(method: "Runtime.evaluate",callback?: (err: Error | null,params: Runtime.EvaluateReturnType,) => void,): void
optional
callback: (err: Error | null,params: Runtime.EvaluateReturnType,) => void
void
Session.prototype.post(method: "Runtime.awaitPromise",params?: Runtime.AwaitPromiseParameterType,callback?: (err: Error | null,params: Runtime.AwaitPromiseReturnType,) => void,): void
Add handler to promise with given promise object id.
optional
params: Runtime.AwaitPromiseParameterType
optional
callback: (err: Error | null,params: Runtime.AwaitPromiseReturnType,) => void
void
Session.prototype.post(method: "Runtime.awaitPromise",callback?: (err: Error | null,params: Runtime.AwaitPromiseReturnType,) => void,): void
optional
callback: (err: Error | null,params: Runtime.AwaitPromiseReturnType,) => void
void
Session.prototype.post(method: "Runtime.callFunctionOn",params?: Runtime.CallFunctionOnParameterType,callback?: (err: Error | null,params: Runtime.CallFunctionOnReturnType,) => void,): void
Calls function with given declaration on the given object. Object group of the result is inherited from the target object.
optional
params: Runtime.CallFunctionOnParameterType
optional
callback: (err: Error | null,params: Runtime.CallFunctionOnReturnType,) => void
void
Session.prototype.post(method: "Runtime.callFunctionOn",callback?: (err: Error | null,params: Runtime.CallFunctionOnReturnType,) => void,): void
optional
callback: (err: Error | null,params: Runtime.CallFunctionOnReturnType,) => void
void
Session.prototype.post(method: "Runtime.getProperties",params?: Runtime.GetPropertiesParameterType,callback?: (err: Error | null,params: Runtime.GetPropertiesReturnType,) => void,): void
Returns properties of a given object. Object group of the result is inherited from the target object.
optional
params: Runtime.GetPropertiesParameterType
optional
callback: (err: Error | null,params: Runtime.GetPropertiesReturnType,) => void
void
Session.prototype.post(method: "Runtime.getProperties",callback?: (err: Error | null,params: Runtime.GetPropertiesReturnType,) => void,): void
optional
callback: (err: Error | null,params: Runtime.GetPropertiesReturnType,) => void
void
Session.prototype.post(method: "Runtime.releaseObject",params?: Runtime.ReleaseObjectParameterType,callback?: (err: Error | null) => void,): void
Releases remote object with given id.
optional
params: Runtime.ReleaseObjectParameterType
void
Session.prototype.post(method: "Runtime.releaseObject",callback?: (err: Error | null) => void,): void
Session.prototype.post(method: "Runtime.releaseObjectGroup",params?: Runtime.ReleaseObjectGroupParameterType,callback?: (err: Error | null) => void,): void
Releases all remote objects that belong to a given group.
optional
params: Runtime.ReleaseObjectGroupParameterType
void
Session.prototype.post(method: "Runtime.releaseObjectGroup",callback?: (err: Error | null) => void,): void
Session.prototype.post(method: "Runtime.runIfWaitingForDebugger",callback?: (err: Error | null) => void,): void
Session.prototype.post(method: "Runtime.discardConsoleEntries",callback?: (err: Error | null) => void,): void
Session.prototype.post(method: "Runtime.setCustomObjectFormatterEnabled",callback?: (err: Error | null) => void,): void
optional
params: Runtime.SetCustomObjectFormatterEnabledParameterType
void
Session.prototype.post(method: "Runtime.setCustomObjectFormatterEnabled",callback?: (err: Error | null) => void,): void
Session.prototype.post(method: "Runtime.compileScript",params?: Runtime.CompileScriptParameterType,callback?: (err: Error | null,params: Runtime.CompileScriptReturnType,) => void,): void
Compiles expression.
optional
params: Runtime.CompileScriptParameterType
optional
callback: (err: Error | null,params: Runtime.CompileScriptReturnType,) => void
void
Session.prototype.post(method: "Runtime.compileScript",callback?: (err: Error | null,params: Runtime.CompileScriptReturnType,) => void,): void
optional
callback: (err: Error | null,params: Runtime.CompileScriptReturnType,) => void
void
Session.prototype.post(method: "Runtime.runScript",params?: Runtime.RunScriptParameterType,callback?: (err: Error | null,params: Runtime.RunScriptReturnType,) => void,): void
Runs script with given id in a given context.
optional
params: Runtime.RunScriptParameterType
optional
callback: (err: Error | null,params: Runtime.RunScriptReturnType,) => void
void
Session.prototype.post(method: "Runtime.runScript",callback?: (err: Error | null,params: Runtime.RunScriptReturnType,) => void,): void
optional
callback: (err: Error | null,params: Runtime.RunScriptReturnType,) => void
void
Session.prototype.post(method: "Runtime.queryObjects",params?: Runtime.QueryObjectsParameterType,callback?: (err: Error | null,params: Runtime.QueryObjectsReturnType,) => void,): void
optional
params: Runtime.QueryObjectsParameterType
optional
callback: (err: Error | null,params: Runtime.QueryObjectsReturnType,) => void
void
Session.prototype.post(method: "Runtime.queryObjects",callback?: (err: Error | null,params: Runtime.QueryObjectsReturnType,) => void,): void
optional
callback: (err: Error | null,params: Runtime.QueryObjectsReturnType,) => void
void
Session.prototype.post(method: "Runtime.globalLexicalScopeNames",callback?: (err: Error | null,) => void,): void
Returns all let, const and class variables from global scope.
optional
params: Runtime.GlobalLexicalScopeNamesParameterType
void
Session.prototype.post(method: "Runtime.globalLexicalScopeNames",callback?: (err: Error | null,) => void,): void
Session.prototype.post(method: "Debugger.enable",callback?: (err: Error | null,params: Debugger.EnableReturnType,) => void,): void
Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received.
optional
callback: (err: Error | null,params: Debugger.EnableReturnType,) => void
void
Session.prototype.post(method: "Debugger.setBreakpointsActive",callback?: (err: Error | null) => void,): void
Activates / deactivates all breakpoints on the page.
optional
params: Debugger.SetBreakpointsActiveParameterType
void
Session.prototype.post(method: "Debugger.setBreakpointsActive",callback?: (err: Error | null) => void,): void
Session.prototype.post(method: "Debugger.setSkipAllPauses",params?: Debugger.SetSkipAllPausesParameterType,callback?: (err: Error | null) => void,): void
Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc).
optional
params: Debugger.SetSkipAllPausesParameterType
void
Session.prototype.post(method: "Debugger.setSkipAllPauses",callback?: (err: Error | null) => void,): void
Session.prototype.post(method: "Debugger.setBreakpointByUrl",params?: Debugger.SetBreakpointByUrlParameterType,callback?: (err: Error | null,) => void,): void
Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this command is issued, all existing parsed scripts will have breakpoints resolved and returned in
locations
property. Further matching script parsing will result in subsequent breakpointResolved
events issued. This logical breakpoint will survive page reloads.optional
params: Debugger.SetBreakpointByUrlParameterType
void
Session.prototype.post(method: "Debugger.setBreakpointByUrl",callback?: (err: Error | null,) => void,): void
Session.prototype.post(method: "Debugger.setBreakpoint",params?: Debugger.SetBreakpointParameterType,callback?: (err: Error | null,params: Debugger.SetBreakpointReturnType,) => void,): void
Sets JavaScript breakpoint at a given location.
optional
params: Debugger.SetBreakpointParameterType
optional
callback: (err: Error | null,params: Debugger.SetBreakpointReturnType,) => void
void
Session.prototype.post(method: "Debugger.setBreakpoint",callback?: (err: Error | null,params: Debugger.SetBreakpointReturnType,) => void,): void
optional
callback: (err: Error | null,params: Debugger.SetBreakpointReturnType,) => void
void
Session.prototype.post(method: "Debugger.removeBreakpoint",params?: Debugger.RemoveBreakpointParameterType,callback?: (err: Error | null) => void,): void
Removes JavaScript breakpoint.
optional
params: Debugger.RemoveBreakpointParameterType
void
Session.prototype.post(method: "Debugger.removeBreakpoint",callback?: (err: Error | null) => void,): void
Session.prototype.post(method: "Debugger.getPossibleBreakpoints",callback?: (err: Error | null,) => void,): void
Returns possible locations for breakpoint. scriptId in start and end range locations should be the same.
optional
params: Debugger.GetPossibleBreakpointsParameterType
void
Session.prototype.post(method: "Debugger.getPossibleBreakpoints",callback?: (err: Error | null,) => void,): void
Session.prototype.post(method: "Debugger.continueToLocation",params?: Debugger.ContinueToLocationParameterType,callback?: (err: Error | null) => void,): void
Continues execution until specific location is reached.
optional
params: Debugger.ContinueToLocationParameterType
void
Session.prototype.post(method: "Debugger.continueToLocation",callback?: (err: Error | null) => void,): void
Session.prototype.post(method: "Debugger.pauseOnAsyncCall",params?: Debugger.PauseOnAsyncCallParameterType,callback?: (err: Error | null) => void,): void
optional
params: Debugger.PauseOnAsyncCallParameterType
void
Session.prototype.post(method: "Debugger.pauseOnAsyncCall",callback?: (err: Error | null) => void,): void
Session.prototype.post(method: "Debugger.stepInto",params?: Debugger.StepIntoParameterType,callback?: (err: Error | null) => void,): void
Steps into the function call.
optional
params: Debugger.StepIntoParameterType
void
Session.prototype.post(method: "Debugger.scheduleStepIntoAsync",callback?: (err: Error | null) => void,): void
This method is deprecated - use Debugger.stepInto with breakOnAsyncCall and Debugger.pauseOnAsyncTask instead. Steps into next scheduled async task if any is scheduled before next pause. Returns success when async task is actually scheduled, returns error if no task were scheduled or another scheduleStepIntoAsync was called.
void
Session.prototype.post(method: "Debugger.getStackTrace",params?: Debugger.GetStackTraceParameterType,callback?: (err: Error | null,params: Debugger.GetStackTraceReturnType,) => void,): void
Returns stack trace with given
stackTraceId
.optional
params: Debugger.GetStackTraceParameterType
optional
callback: (err: Error | null,params: Debugger.GetStackTraceReturnType,) => void
void
Session.prototype.post(method: "Debugger.getStackTrace",callback?: (err: Error | null,params: Debugger.GetStackTraceReturnType,) => void,): void
optional
callback: (err: Error | null,params: Debugger.GetStackTraceReturnType,) => void
void
Session.prototype.post(method: "Debugger.searchInContent",params?: Debugger.SearchInContentParameterType,callback?: (err: Error | null,params: Debugger.SearchInContentReturnType,) => void,): void
Searches for given string in script content.
optional
params: Debugger.SearchInContentParameterType
optional
callback: (err: Error | null,params: Debugger.SearchInContentReturnType,) => void
void
Session.prototype.post(method: "Debugger.searchInContent",callback?: (err: Error | null,params: Debugger.SearchInContentReturnType,) => void,): void
optional
callback: (err: Error | null,params: Debugger.SearchInContentReturnType,) => void
void
Session.prototype.post(method: "Debugger.setScriptSource",params?: Debugger.SetScriptSourceParameterType,callback?: (err: Error | null,params: Debugger.SetScriptSourceReturnType,) => void,): void
Edits JavaScript source live.
optional
params: Debugger.SetScriptSourceParameterType
optional
callback: (err: Error | null,params: Debugger.SetScriptSourceReturnType,) => void
void
Session.prototype.post(method: "Debugger.setScriptSource",callback?: (err: Error | null,params: Debugger.SetScriptSourceReturnType,) => void,): void
optional
callback: (err: Error | null,params: Debugger.SetScriptSourceReturnType,) => void
void
Session.prototype.post(method: "Debugger.restartFrame",params?: Debugger.RestartFrameParameterType,callback?: (err: Error | null,params: Debugger.RestartFrameReturnType,) => void,): void
Restarts particular call frame from the beginning.
optional
params: Debugger.RestartFrameParameterType
optional
callback: (err: Error | null,params: Debugger.RestartFrameReturnType,) => void
void
Session.prototype.post(method: "Debugger.restartFrame",callback?: (err: Error | null,params: Debugger.RestartFrameReturnType,) => void,): void
optional
callback: (err: Error | null,params: Debugger.RestartFrameReturnType,) => void
void
Session.prototype.post(method: "Debugger.getScriptSource",params?: Debugger.GetScriptSourceParameterType,callback?: (err: Error | null,params: Debugger.GetScriptSourceReturnType,) => void,): void
Returns source for the script with given id.
optional
params: Debugger.GetScriptSourceParameterType
optional
callback: (err: Error | null,params: Debugger.GetScriptSourceReturnType,) => void
void
Session.prototype.post(method: "Debugger.getScriptSource",callback?: (err: Error | null,params: Debugger.GetScriptSourceReturnType,) => void,): void
optional
callback: (err: Error | null,params: Debugger.GetScriptSourceReturnType,) => void
void
Session.prototype.post(method: "Debugger.setPauseOnExceptions",callback?: (err: Error | null) => void,): void
Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions. Initial pause on exceptions state is
none
.optional
params: Debugger.SetPauseOnExceptionsParameterType
void
Session.prototype.post(method: "Debugger.setPauseOnExceptions",callback?: (err: Error | null) => void,): void
Session.prototype.post(method: "Debugger.evaluateOnCallFrame",callback?: (err: Error | null,) => void,): void
Evaluates expression on a given call frame.
optional
params: Debugger.EvaluateOnCallFrameParameterType
void
Session.prototype.post(method: "Debugger.evaluateOnCallFrame",callback?: (err: Error | null,) => void,): void
Session.prototype.post(method: "Debugger.setVariableValue",params?: Debugger.SetVariableValueParameterType,callback?: (err: Error | null) => void,): void
Changes value of variable in a callframe. Object-based scopes are not supported and must be mutated manually.
optional
params: Debugger.SetVariableValueParameterType
void
Session.prototype.post(method: "Debugger.setVariableValue",callback?: (err: Error | null) => void,): void
Session.prototype.post(method: "Debugger.setReturnValue",params?: Debugger.SetReturnValueParameterType,callback?: (err: Error | null) => void,): void
Changes return value in top frame. Available only at return break position.
optional
params: Debugger.SetReturnValueParameterType
void
Session.prototype.post(method: "Debugger.setReturnValue",callback?: (err: Error | null) => void,): void
Session.prototype.post(method: "Debugger.setAsyncCallStackDepth",callback?: (err: Error | null) => void,): void
Enables or disables async call stacks tracking.
optional
params: Debugger.SetAsyncCallStackDepthParameterType
void
Session.prototype.post(method: "Debugger.setAsyncCallStackDepth",callback?: (err: Error | null) => void,): void
Session.prototype.post(method: "Debugger.setBlackboxPatterns",callback?: (err: Error | null) => void,): void
Replace previous blackbox patterns with passed ones. Forces backend to skip stepping/pausing in scripts with url matching one of the patterns. VM will try to leave blackboxed script by performing 'step in' several times, finally resorting to 'step out' if unsuccessful.
optional
params: Debugger.SetBlackboxPatternsParameterType
void
Session.prototype.post(method: "Debugger.setBlackboxPatterns",callback?: (err: Error | null) => void,): void
Session.prototype.post(method: "Debugger.setBlackboxedRanges",callback?: (err: Error | null) => void,): void
Makes backend skip steps in the script in blackboxed ranges. VM will try leave blacklisted scripts by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. Positions array contains positions where blackbox state is changed. First interval isn't blackboxed. Array should be sorted.
optional
params: Debugger.SetBlackboxedRangesParameterType
void
Session.prototype.post(method: "Debugger.setBlackboxedRanges",callback?: (err: Error | null) => void,): void
Session.prototype.post(method: "Console.clearMessages",callback?: (err: Error | null) => void,): void
Session.prototype.post(method: "Profiler.setSamplingInterval",callback?: (err: Error | null) => void,): void
Changes CPU profiler sampling interval. Must be called before CPU profiles recording started.
optional
params: Profiler.SetSamplingIntervalParameterType
void
Session.prototype.post(method: "Profiler.setSamplingInterval",callback?: (err: Error | null) => void,): void
Session.prototype.post(method: "Profiler.stop",callback?: (err: Error | null,params: Profiler.StopReturnType,) => void,): void
optional
callback: (err: Error | null,params: Profiler.StopReturnType,) => void
void
Session.prototype.post(method: "Profiler.startPreciseCoverage",callback?: (err: Error | null) => void,): void
Enable precise code coverage. Coverage data for JavaScript executed before enabling precise code coverage may be incomplete. Enabling prevents running optimized code and resets execution counters.
optional
params: Profiler.StartPreciseCoverageParameterType
void
Session.prototype.post(method: "Profiler.startPreciseCoverage",callback?: (err: Error | null) => void,): void
Session.prototype.post(method: "Profiler.stopPreciseCoverage",callback?: (err: Error | null) => void,): void
Session.prototype.post(method: "Profiler.takePreciseCoverage",callback?: (err: Error | null,) => void,): void
Session.prototype.post(method: "Profiler.getBestEffortCoverage",callback?: (err: Error | null,) => void,): void
Session.prototype.post(method: "HeapProfiler.disable",callback?: (err: Error | null) => void,): void
Session.prototype.post(method: "HeapProfiler.startTrackingHeapObjects",callback?: (err: Error | null) => void,): void
optional
params: HeapProfiler.StartTrackingHeapObjectsParameterType
void
Session.prototype.post(method: "HeapProfiler.startTrackingHeapObjects",callback?: (err: Error | null) => void,): void
Session.prototype.post(method: "HeapProfiler.stopTrackingHeapObjects",callback?: (err: Error | null) => void,): void
optional
params: HeapProfiler.StopTrackingHeapObjectsParameterType
void
Session.prototype.post(method: "HeapProfiler.stopTrackingHeapObjects",callback?: (err: Error | null) => void,): void
Session.prototype.post(method: "HeapProfiler.takeHeapSnapshot",callback?: (err: Error | null) => void,): void
optional
params: HeapProfiler.TakeHeapSnapshotParameterType
void
Session.prototype.post(method: "HeapProfiler.takeHeapSnapshot",callback?: (err: Error | null) => void,): void
Session.prototype.post(method: "HeapProfiler.collectGarbage",callback?: (err: Error | null) => void,): void
Session.prototype.post(method: "HeapProfiler.getObjectByHeapObjectId",callback?: (err: Error | null,) => void,): void
optional
params: HeapProfiler.GetObjectByHeapObjectIdParameterType
void
Session.prototype.post(method: "HeapProfiler.getObjectByHeapObjectId",callback?: (err: Error | null,) => void,): void
Session.prototype.post(method: "HeapProfiler.addInspectedHeapObject",callback?: (err: Error | null) => void,): void
Enables console to refer to the node with given id via $x (see Command Line API for more details $x functions).
optional
params: HeapProfiler.AddInspectedHeapObjectParameterType
void
Session.prototype.post(method: "HeapProfiler.addInspectedHeapObject",callback?: (err: Error | null) => void,): void
Session.prototype.post(method: "HeapProfiler.getHeapObjectId",callback?: (err: Error | null,) => void,): void
optional
params: HeapProfiler.GetHeapObjectIdParameterType
void
Session.prototype.post(method: "HeapProfiler.getHeapObjectId",callback?: (err: Error | null,) => void,): void
Session.prototype.post(method: "HeapProfiler.startSampling",params?: HeapProfiler.StartSamplingParameterType,callback?: (err: Error | null) => void,): void
optional
params: HeapProfiler.StartSamplingParameterType
void
Session.prototype.post(method: "HeapProfiler.startSampling",callback?: (err: Error | null) => void,): void
Session.prototype.post(method: "HeapProfiler.stopSampling",callback?: (err: Error | null,params: HeapProfiler.StopSamplingReturnType,) => void,): void
optional
callback: (err: Error | null,params: HeapProfiler.StopSamplingReturnType,) => void
void
Session.prototype.post(method: "HeapProfiler.getSamplingProfile",callback?: (err: Error | null,) => void,): void
Session.prototype.post(method: "NodeTracing.getCategories",callback?: (err: Error | null,params: NodeTracing.GetCategoriesReturnType,) => void,): void
Gets supported tracing categories.
optional
callback: (err: Error | null,params: NodeTracing.GetCategoriesReturnType,) => void
void
Session.prototype.post(method: "NodeTracing.start",params?: NodeTracing.StartParameterType,callback?: (err: Error | null) => void,): void
Start trace events collection.
optional
params: NodeTracing.StartParameterType
void
Session.prototype.post(method: "NodeWorker.sendMessageToWorker",callback?: (err: Error | null) => void,): void
Sends protocol message over session with given id.
optional
params: NodeWorker.SendMessageToWorkerParameterType
void
Session.prototype.post(method: "NodeWorker.sendMessageToWorker",callback?: (err: Error | null) => void,): void
Session.prototype.post(method: "NodeWorker.enable",params?: NodeWorker.EnableParameterType,callback?: (err: Error | null) => void,): void
Instructs the inspector to attach to running workers. Will also attach to new workers
as they start
optional
params: NodeWorker.EnableParameterType
void
Session.prototype.post(method: "NodeWorker.detach",params?: NodeWorker.DetachParameterType,callback?: (err: Error | null) => void,): void
Detached from the worker with given sessionId.
optional
params: NodeWorker.DetachParameterType
void
Session.prototype.post(method: "NodeRuntime.notifyWhenWaitingForDisconnect",callback?: (err: Error | null) => void,): void
Enable the `NodeRuntime.waitingForDisconnect`.
optional
params: NodeRuntime.NotifyWhenWaitingForDisconnectParameterType
void