JSPM

  • Created
  • Published
  • Downloads 1304
  • Score
    100M100P100Q107040F
  • License

v8 debugger extending API

Package Exports

  • v8-debug

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (v8-debug) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Build Status

v8-debug

Provides extending API for node internal debugger protocol (based on v8 debugger protocol)

This is a part of node-inspector.

Installation

npm install v8-debug

API

Command Params Type Description
register Register new debug processor command like 'lookup'.
name {String} Name of command.
callback {Function} function(request, response) modify your response in this function.
command Call debug processor command like 'lookup'
name {String} Name of command.
attributes {Object} Extra parameters, that passes as command arguments.
userdata {Object} Data than needs to be stored, but can't be serialised before call processor callback. (Not implemented now)
commandToEvent Convert command response object to default event object with same name
request {Object} Request object created by debugger
response {Object} Response object that needs to be converted

Usage

var debug = require('v8-debug');

//register 'console' event in v8 debugger protocol
debug.register('console', function(request, response) {
  debug.commandToEvent(request, response);
});
//Now debugger can emit new event 'console'

console.log = (function(fn) {
  return function() {
    //Call 'console' command. (Emit console event)
    debug.command('console', {message: arguments[0]} /*, userdata*/);
    return fn.apply(console, arguments);
  }
} (console.log));

For more experience see protocol documentation