Skip to content package
v8-debug v1.0.1 v8 debugger extending API
node >=0.10 2 deps cjs open source
overview readme
license Unknown
deps 2
unpacked Unknown
files Unknown
node >=0.10 $ npm install v8-debug@1.0.1n npmREADME GitHub-flavored package documentation.
downloads Across all versions.
Download trend unavailable.
compatibility Runtime metadata.
install size Estimated unpacked size across 33 packages.
6.7 MB
Includes dependencies.
dependencies 2 direct · 1 outdated
versions Latest published Mar 28, 2017
May 8, 2016
maintainers Registry package owners.
v8-debug
Installation
API
registerCommand(name, callback) Registers new debug processor command, like lookup.
callback accepts two arguments - request and response .
You need to modify response.body if you want to return something to caller.
debug. registerCommand ( '_lookup' , function (request, response) {
var test = request.attributes;
//do someting here
//and modify response
response.body = {
test: test
};
}); copy
registerEvent(eventName) debug. registerCommand ( 'someEvent' , debug.commandToEvent); copy
execCommand(commandName, attributes) Calls debug processor command like 'lookup'.
attributes will be passed to registerCommand.callback as request.attributes.
attributes needs to be valid JSON object.
debug. registerCommand ( '_lookup' , function (request, response) {
var test = request.attributes;
//do someting here
//and modify response
response.body = {
test: test
};
});
debug. execCommand ( '_lookup' , { attr: 'test' }); copy
emitEvent(eventName, attributes) This is a semantic alias for execCommand
debug. emitEvent ( 'myEvent' , { attr: 'test' }); copy
commandToEvent(request, response) response object has a different structure for commands and events.
By default registerCommand.callback receives command's response.
This is a small converter.
debug. registerCommand ( 'someEvent1' , function (request, response) {
debug. commandToEvent (request, response);
});
debug. registerCommand ( 'someEvent2' , debug.commandToEvent); copy Use debug.registerEvent instead of this.
runInDebugContext(script) Evaluates string or function (will be stringifyed) in debug context.
var MakeMirror = debug. get ( 'MakeMirror' );
var mirror = MakeMirror ({ test: 1 }); copy
getFromFrame(index, value) Tries to receive a value from targeted frame scopes
function a (options) {
//...
b ();
}
function b () {
// There is no info about `options` object
var options = debug. getFromFrame ( 1 , 'options' );
} copy
enableWebkitProtocol() Enables experimental usage of WebKit protocol
registerAgentCommand(command, parameters, callback) Experimental method for registering WebKit protocol handlers
Usage Simple console.log checking
var debug = require ( 'v8-debug' );
debug. registerEvent ( 'console.log' );
console.log = ( function (fn) {
return function () {
debug. emitEvent ( 'console.log' , {message: arguments [ 0 ]} /*, userdata*/ );
return fn. apply (console, arguments );
}
} (console.log)); copy