Session.prototype.post(method: string,callback?: (err: Error | null,params?: object,) => void,): voidPosts 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.
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.
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.
voidSession.prototype.post(method: string,params?: object,callback?: (err: Error | null,params?: object,) => void,): voidSession.prototype.post(method: "Schema.getDomains",callback?: (err: Error | null,params: Schema.GetDomainsReturnType,) => void,): voidReturns supported domains.
callback: (err: Error | null,params: Schema.GetDomainsReturnType,) => voidvoidSession.prototype.post(method: "Runtime.evaluate",params?: Runtime.EvaluateParameterType,callback?: (err: Error | null,params: Runtime.EvaluateReturnType,) => void,): voidEvaluates expression on global object.
params: Runtime.EvaluateParameterTypecallback: (err: Error | null,params: Runtime.EvaluateReturnType,) => voidvoidSession.prototype.post(method: "Runtime.evaluate",callback?: (err: Error | null,params: Runtime.EvaluateReturnType,) => void,): voidcallback: (err: Error | null,params: Runtime.EvaluateReturnType,) => voidvoidSession.prototype.post(method: "Runtime.awaitPromise",params?: Runtime.AwaitPromiseParameterType,callback?: (err: Error | null,params: Runtime.AwaitPromiseReturnType,) => void,): voidAdd handler to promise with given promise object id.
params: Runtime.AwaitPromiseParameterTypecallback: (err: Error | null,params: Runtime.AwaitPromiseReturnType,) => voidvoidSession.prototype.post(method: "Runtime.awaitPromise",callback?: (err: Error | null,params: Runtime.AwaitPromiseReturnType,) => void,): voidcallback: (err: Error | null,params: Runtime.AwaitPromiseReturnType,) => voidvoidSession.prototype.post(method: "Runtime.callFunctionOn",params?: Runtime.CallFunctionOnParameterType,callback?: (err: Error | null,params: Runtime.CallFunctionOnReturnType,) => void,): voidCalls function with given declaration on the given object. Object group of the result is inherited from the target object.
params: Runtime.CallFunctionOnParameterTypecallback: (err: Error | null,params: Runtime.CallFunctionOnReturnType,) => voidvoidSession.prototype.post(method: "Runtime.callFunctionOn",callback?: (err: Error | null,params: Runtime.CallFunctionOnReturnType,) => void,): voidcallback: (err: Error | null,params: Runtime.CallFunctionOnReturnType,) => voidvoidSession.prototype.post(method: "Runtime.getProperties",params?: Runtime.GetPropertiesParameterType,callback?: (err: Error | null,params: Runtime.GetPropertiesReturnType,) => void,): voidReturns properties of a given object. Object group of the result is inherited from the target object.
params: Runtime.GetPropertiesParameterTypecallback: (err: Error | null,params: Runtime.GetPropertiesReturnType,) => voidvoidSession.prototype.post(method: "Runtime.getProperties",callback?: (err: Error | null,params: Runtime.GetPropertiesReturnType,) => void,): voidcallback: (err: Error | null,params: Runtime.GetPropertiesReturnType,) => voidvoidSession.prototype.post(method: "Runtime.releaseObject",params?: Runtime.ReleaseObjectParameterType,callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Runtime.releaseObject",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Runtime.releaseObjectGroup",params?: Runtime.ReleaseObjectGroupParameterType,callback?: (err: Error | null) => void,): voidReleases all remote objects that belong to a given group.
params: Runtime.ReleaseObjectGroupParameterTypevoidSession.prototype.post(method: "Runtime.releaseObjectGroup",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Runtime.runIfWaitingForDebugger",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Runtime.enable",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Runtime.disable",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Runtime.discardConsoleEntries",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Runtime.setCustomObjectFormatterEnabled",callback?: (err: Error | null) => void,): voidparams: Runtime.SetCustomObjectFormatterEnabledParameterTypevoidSession.prototype.post(method: "Runtime.setCustomObjectFormatterEnabled",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Runtime.compileScript",params?: Runtime.CompileScriptParameterType,callback?: (err: Error | null,params: Runtime.CompileScriptReturnType,) => void,): voidCompiles expression.
params: Runtime.CompileScriptParameterTypecallback: (err: Error | null,params: Runtime.CompileScriptReturnType,) => voidvoidSession.prototype.post(method: "Runtime.compileScript",callback?: (err: Error | null,params: Runtime.CompileScriptReturnType,) => void,): voidcallback: (err: Error | null,params: Runtime.CompileScriptReturnType,) => voidvoidSession.prototype.post(method: "Runtime.runScript",params?: Runtime.RunScriptParameterType,callback?: (err: Error | null,params: Runtime.RunScriptReturnType,) => void,): voidRuns script with given id in a given context.
params: Runtime.RunScriptParameterTypecallback: (err: Error | null,params: Runtime.RunScriptReturnType,) => voidvoidSession.prototype.post(method: "Runtime.runScript",callback?: (err: Error | null,params: Runtime.RunScriptReturnType,) => void,): voidcallback: (err: Error | null,params: Runtime.RunScriptReturnType,) => voidvoidSession.prototype.post(method: "Runtime.queryObjects",params?: Runtime.QueryObjectsParameterType,callback?: (err: Error | null,params: Runtime.QueryObjectsReturnType,) => void,): voidparams: Runtime.QueryObjectsParameterTypecallback: (err: Error | null,params: Runtime.QueryObjectsReturnType,) => voidvoidSession.prototype.post(method: "Runtime.queryObjects",callback?: (err: Error | null,params: Runtime.QueryObjectsReturnType,) => void,): voidcallback: (err: Error | null,params: Runtime.QueryObjectsReturnType,) => voidvoidSession.prototype.post(method: "Runtime.globalLexicalScopeNames",callback?: (err: Error | null,) => void,): voidReturns all let, const and class variables from global scope.
params: Runtime.GlobalLexicalScopeNamesParameterTypevoidSession.prototype.post(method: "Runtime.globalLexicalScopeNames",callback?: (err: Error | null,) => void,): voidSession.prototype.post(method: "Debugger.enable",callback?: (err: Error | null,params: Debugger.EnableReturnType,) => void,): voidEnables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received.
callback: (err: Error | null,params: Debugger.EnableReturnType,) => voidvoidSession.prototype.post(method: "Debugger.disable",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Debugger.setBreakpointsActive",callback?: (err: Error | null) => void,): voidActivates / deactivates all breakpoints on the page.
params: Debugger.SetBreakpointsActiveParameterTypevoidSession.prototype.post(method: "Debugger.setBreakpointsActive",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Debugger.setSkipAllPauses",params?: Debugger.SetSkipAllPausesParameterType,callback?: (err: Error | null) => void,): voidMakes page not interrupt on any pauses (breakpoint, exception, dom exception etc).
params: Debugger.SetSkipAllPausesParameterTypevoidSession.prototype.post(method: "Debugger.setSkipAllPauses",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Debugger.setBreakpointByUrl",params?: Debugger.SetBreakpointByUrlParameterType,callback?: (err: Error | null,) => void,): voidSets 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.
params: Debugger.SetBreakpointByUrlParameterTypevoidSession.prototype.post(method: "Debugger.setBreakpointByUrl",callback?: (err: Error | null,) => void,): voidSession.prototype.post(method: "Debugger.setBreakpoint",params?: Debugger.SetBreakpointParameterType,callback?: (err: Error | null,params: Debugger.SetBreakpointReturnType,) => void,): voidSets JavaScript breakpoint at a given location.
params: Debugger.SetBreakpointParameterTypecallback: (err: Error | null,params: Debugger.SetBreakpointReturnType,) => voidvoidSession.prototype.post(method: "Debugger.setBreakpoint",callback?: (err: Error | null,params: Debugger.SetBreakpointReturnType,) => void,): voidcallback: (err: Error | null,params: Debugger.SetBreakpointReturnType,) => voidvoidSession.prototype.post(method: "Debugger.removeBreakpoint",params?: Debugger.RemoveBreakpointParameterType,callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Debugger.removeBreakpoint",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Debugger.getPossibleBreakpoints",callback?: (err: Error | null,) => void,): voidReturns possible locations for breakpoint. scriptId in start and end range locations should be the same.
params: Debugger.GetPossibleBreakpointsParameterTypevoidSession.prototype.post(method: "Debugger.getPossibleBreakpoints",callback?: (err: Error | null,) => void,): voidSession.prototype.post(method: "Debugger.continueToLocation",params?: Debugger.ContinueToLocationParameterType,callback?: (err: Error | null) => void,): voidContinues execution until specific location is reached.
params: Debugger.ContinueToLocationParameterTypevoidSession.prototype.post(method: "Debugger.continueToLocation",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Debugger.pauseOnAsyncCall",params?: Debugger.PauseOnAsyncCallParameterType,callback?: (err: Error | null) => void,): voidparams: Debugger.PauseOnAsyncCallParameterTypevoidSession.prototype.post(method: "Debugger.pauseOnAsyncCall",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Debugger.stepOver",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Debugger.stepInto",params?: Debugger.StepIntoParameterType,callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Debugger.stepInto",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Debugger.stepOut",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Debugger.pause",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Debugger.scheduleStepIntoAsync",callback?: (err: Error | null) => void,): voidThis 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.
voidSession.prototype.post(method: "Debugger.resume",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Debugger.getStackTrace",params?: Debugger.GetStackTraceParameterType,callback?: (err: Error | null,params: Debugger.GetStackTraceReturnType,) => void,): voidReturns stack trace with given stackTraceId.
params: Debugger.GetStackTraceParameterTypecallback: (err: Error | null,params: Debugger.GetStackTraceReturnType,) => voidvoidSession.prototype.post(method: "Debugger.getStackTrace",callback?: (err: Error | null,params: Debugger.GetStackTraceReturnType,) => void,): voidcallback: (err: Error | null,params: Debugger.GetStackTraceReturnType,) => voidvoidSession.prototype.post(method: "Debugger.searchInContent",params?: Debugger.SearchInContentParameterType,callback?: (err: Error | null,params: Debugger.SearchInContentReturnType,) => void,): voidSearches for given string in script content.
params: Debugger.SearchInContentParameterTypecallback: (err: Error | null,params: Debugger.SearchInContentReturnType,) => voidvoidSession.prototype.post(method: "Debugger.searchInContent",callback?: (err: Error | null,params: Debugger.SearchInContentReturnType,) => void,): voidcallback: (err: Error | null,params: Debugger.SearchInContentReturnType,) => voidvoidSession.prototype.post(method: "Debugger.setScriptSource",params?: Debugger.SetScriptSourceParameterType,callback?: (err: Error | null,params: Debugger.SetScriptSourceReturnType,) => void,): voidEdits JavaScript source live.
params: Debugger.SetScriptSourceParameterTypecallback: (err: Error | null,params: Debugger.SetScriptSourceReturnType,) => voidvoidSession.prototype.post(method: "Debugger.setScriptSource",callback?: (err: Error | null,params: Debugger.SetScriptSourceReturnType,) => void,): voidcallback: (err: Error | null,params: Debugger.SetScriptSourceReturnType,) => voidvoidSession.prototype.post(method: "Debugger.restartFrame",params?: Debugger.RestartFrameParameterType,callback?: (err: Error | null,params: Debugger.RestartFrameReturnType,) => void,): voidRestarts particular call frame from the beginning.
params: Debugger.RestartFrameParameterTypecallback: (err: Error | null,params: Debugger.RestartFrameReturnType,) => voidvoidSession.prototype.post(method: "Debugger.restartFrame",callback?: (err: Error | null,params: Debugger.RestartFrameReturnType,) => void,): voidcallback: (err: Error | null,params: Debugger.RestartFrameReturnType,) => voidvoidSession.prototype.post(method: "Debugger.getScriptSource",params?: Debugger.GetScriptSourceParameterType,callback?: (err: Error | null,params: Debugger.GetScriptSourceReturnType,) => void,): voidReturns source for the script with given id.
params: Debugger.GetScriptSourceParameterTypecallback: (err: Error | null,params: Debugger.GetScriptSourceReturnType,) => voidvoidSession.prototype.post(method: "Debugger.getScriptSource",callback?: (err: Error | null,params: Debugger.GetScriptSourceReturnType,) => void,): voidcallback: (err: Error | null,params: Debugger.GetScriptSourceReturnType,) => voidvoidSession.prototype.post(method: "Debugger.setPauseOnExceptions",callback?: (err: Error | null) => void,): voidDefines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions. Initial pause on exceptions state is none.
params: Debugger.SetPauseOnExceptionsParameterTypevoidSession.prototype.post(method: "Debugger.setPauseOnExceptions",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Debugger.evaluateOnCallFrame",callback?: (err: Error | null,) => void,): voidEvaluates expression on a given call frame.
params: Debugger.EvaluateOnCallFrameParameterTypevoidSession.prototype.post(method: "Debugger.evaluateOnCallFrame",callback?: (err: Error | null,) => void,): voidSession.prototype.post(method: "Debugger.setVariableValue",params?: Debugger.SetVariableValueParameterType,callback?: (err: Error | null) => void,): voidChanges value of variable in a callframe. Object-based scopes are not supported and must be mutated manually.
params: Debugger.SetVariableValueParameterTypevoidSession.prototype.post(method: "Debugger.setVariableValue",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Debugger.setReturnValue",params?: Debugger.SetReturnValueParameterType,callback?: (err: Error | null) => void,): voidChanges return value in top frame. Available only at return break position.
params: Debugger.SetReturnValueParameterTypevoidSession.prototype.post(method: "Debugger.setReturnValue",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Debugger.setAsyncCallStackDepth",callback?: (err: Error | null) => void,): voidEnables or disables async call stacks tracking.
params: Debugger.SetAsyncCallStackDepthParameterTypevoidSession.prototype.post(method: "Debugger.setAsyncCallStackDepth",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Debugger.setBlackboxPatterns",callback?: (err: Error | null) => void,): voidReplace 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.
params: Debugger.SetBlackboxPatternsParameterTypevoidSession.prototype.post(method: "Debugger.setBlackboxPatterns",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Debugger.setBlackboxedRanges",callback?: (err: Error | null) => void,): voidMakes 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.
params: Debugger.SetBlackboxedRangesParameterTypevoidSession.prototype.post(method: "Debugger.setBlackboxedRanges",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Console.enable",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Console.disable",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Console.clearMessages",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Profiler.enable",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Profiler.disable",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Profiler.setSamplingInterval",callback?: (err: Error | null) => void,): voidChanges CPU profiler sampling interval. Must be called before CPU profiles recording started.
params: Profiler.SetSamplingIntervalParameterTypevoidSession.prototype.post(method: "Profiler.setSamplingInterval",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Profiler.start",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Profiler.stop",callback?: (err: Error | null,params: Profiler.StopReturnType,) => void,): voidcallback: (err: Error | null,params: Profiler.StopReturnType,) => voidvoidSession.prototype.post(method: "Profiler.startPreciseCoverage",callback?: (err: Error | null) => void,): voidEnable 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.
params: Profiler.StartPreciseCoverageParameterTypevoidSession.prototype.post(method: "Profiler.startPreciseCoverage",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Profiler.stopPreciseCoverage",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Profiler.takePreciseCoverage",callback?: (err: Error | null,) => void,): voidSession.prototype.post(method: "Profiler.getBestEffortCoverage",callback?: (err: Error | null,) => void,): voidSession.prototype.post(method: "HeapProfiler.enable",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "HeapProfiler.disable",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "HeapProfiler.startTrackingHeapObjects",callback?: (err: Error | null) => void,): voidparams: HeapProfiler.StartTrackingHeapObjectsParameterTypevoidSession.prototype.post(method: "HeapProfiler.startTrackingHeapObjects",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "HeapProfiler.stopTrackingHeapObjects",callback?: (err: Error | null) => void,): voidparams: HeapProfiler.StopTrackingHeapObjectsParameterTypevoidSession.prototype.post(method: "HeapProfiler.stopTrackingHeapObjects",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "HeapProfiler.takeHeapSnapshot",callback?: (err: Error | null) => void,): voidparams: HeapProfiler.TakeHeapSnapshotParameterTypevoidSession.prototype.post(method: "HeapProfiler.takeHeapSnapshot",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "HeapProfiler.collectGarbage",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "HeapProfiler.getObjectByHeapObjectId",callback?: (err: Error | null,) => void,): voidparams: HeapProfiler.GetObjectByHeapObjectIdParameterTypevoidSession.prototype.post(method: "HeapProfiler.getObjectByHeapObjectId",callback?: (err: Error | null,) => void,): voidSession.prototype.post(method: "HeapProfiler.addInspectedHeapObject",callback?: (err: Error | null) => void,): voidEnables console to refer to the node with given id via $x (see Command Line API for more details $x functions).
params: HeapProfiler.AddInspectedHeapObjectParameterTypevoidSession.prototype.post(method: "HeapProfiler.addInspectedHeapObject",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "HeapProfiler.getHeapObjectId",callback?: (err: Error | null,) => void,): voidparams: HeapProfiler.GetHeapObjectIdParameterTypevoidSession.prototype.post(method: "HeapProfiler.getHeapObjectId",callback?: (err: Error | null,) => void,): voidSession.prototype.post(method: "HeapProfiler.startSampling",params?: HeapProfiler.StartSamplingParameterType,callback?: (err: Error | null) => void,): voidparams: HeapProfiler.StartSamplingParameterTypevoidSession.prototype.post(method: "HeapProfiler.startSampling",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "HeapProfiler.stopSampling",callback?: (err: Error | null,params: HeapProfiler.StopSamplingReturnType,) => void,): voidcallback: (err: Error | null,params: HeapProfiler.StopSamplingReturnType,) => voidvoidSession.prototype.post(method: "HeapProfiler.getSamplingProfile",callback?: (err: Error | null,) => void,): voidSession.prototype.post(method: "NodeTracing.getCategories",callback?: (err: Error | null,params: NodeTracing.GetCategoriesReturnType,) => void,): voidGets supported tracing categories.
callback: (err: Error | null,params: NodeTracing.GetCategoriesReturnType,) => voidvoidSession.prototype.post(method: "NodeTracing.start",params?: NodeTracing.StartParameterType,callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "NodeTracing.start",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "NodeTracing.stop",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "NodeWorker.sendMessageToWorker",callback?: (err: Error | null) => void,): voidSends protocol message over session with given id.
params: NodeWorker.SendMessageToWorkerParameterTypevoidSession.prototype.post(method: "NodeWorker.sendMessageToWorker",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "NodeWorker.enable",params?: NodeWorker.EnableParameterType,callback?: (err: Error | null) => void,): voidInstructs the inspector to attach to running workers. Will also attach to new workers as they start
params: NodeWorker.EnableParameterTypevoidSession.prototype.post(method: "NodeWorker.enable",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "NodeWorker.disable",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "NodeWorker.detach",params?: NodeWorker.DetachParameterType,callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "NodeWorker.detach",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Network.disable",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "Network.enable",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "NodeRuntime.enable",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "NodeRuntime.disable",callback?: (err: Error | null) => void,): voidSession.prototype.post(method: "NodeRuntime.notifyWhenWaitingForDisconnect",callback?: (err: Error | null) => void,): voidEnable the NodeRuntime.waitingForDisconnect.
params: NodeRuntime.NotifyWhenWaitingForDisconnectParameterTypevoid