Comparing version 0.2.0 to 0.3.0
{ | ||
"name": "v8-debug", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "v8 debugger extending API", | ||
@@ -5,0 +5,0 @@ "homepage": "http://github.com/node-inspector/v8-debug", |
[![Build Status](https://secure.travis-ci.org/node-inspector/v8-debug.png?branch=master)](http://travis-ci.org/node-inspector/v8-debug) | ||
# v8-debug | ||
# v8-debug | ||
Provides extending API for [node](http://github.com/ry/node) internal debugger protocol (based on [v8 debugger protocol](https://code.google.com/p/v8/wiki/DebuggerProtocol)) | ||
@@ -16,12 +16,17 @@ | ||
| :---: | :---: | :---: | :--- | | ||
|register|||*Register new debug processor command like 'lookup'.*| | ||
|registerCommand|||*Register new debug processor command, like 'lookup'.* (Alias `register`)| | ||
||name|**{String}**| *Name of command.*| | ||
||callback|**{Function}**|*function(request, response) modify your response in this function.*| | ||
|command|||*Call debug processor command like 'lookup'*| | ||
|registerEvent|||*Register new debug processor event, like 'break'.*| | ||
||name|**{String}**| *Name of command.*| | ||
|execCommand|||*Call debug processor command like 'lookup'.* (Alias `command`)| | ||
||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)| | ||
|emitEvent|||*Like `execCommand`*| | ||
|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*| | ||
|runInDebugContext|||*Evaluate string or function (stringifyed) in debug context.* (Alias `get`)| | ||
||script|**{String/Function}**|*String or _clear_ function that needs to be evaluated in debug context *| | ||
@@ -32,13 +37,19 @@ ## Usage | ||
var debug = require('v8-debug'); | ||
var MakeMirror = debug.get('MakeMirror'); | ||
//register 'console' event in v8 debugger protocol | ||
debug.register('console', function(request, response) { | ||
debug.commandToEvent(request, response); | ||
}); | ||
debug.registerEvent('console'); | ||
//Now debugger can emit new event 'console' | ||
//register '_lookup' command in v8 debugger protocol | ||
debug.registerCommand('_lookup', function(request, response) { | ||
//do someting here | ||
//and modify response | ||
response.body = {}; | ||
}); | ||
console.log = (function(fn) { | ||
return function() { | ||
//Call 'console' command. (Emit console event) | ||
debug.command('console', {message: arguments[0]} /*, userdata*/); | ||
debug.emitEvent('console', {message: arguments[0]} /*, userdata*/); | ||
return fn.apply(console, arguments); | ||
@@ -48,2 +59,2 @@ } | ||
``` | ||
For more experience see [protocol documentation](https://github.com/buggerjs/bugger-v8-client/blob/jk/document-commands/PROTOCOL.md) | ||
For more experience see [protocol documentation](https://github.com/buggerjs/bugger-v8-client/blob/master/PROTOCOL.md) |
@@ -87,7 +87,10 @@ var binding = require('./build/Release/debug.node'); | ||
V8Debug.prototype.register = function(name, func) { | ||
V8Debug.prototype.register = | ||
V8Debug.prototype.registerCommand = function(name, func) { | ||
this._processor.extendedProcessDebugJSONRequestHandles_[name] = func; | ||
}; | ||
V8Debug.prototype.command = function(name, attributes, userdata) { | ||
V8Debug.prototype.command = | ||
V8Debug.prototype.execCommand = | ||
V8Debug.prototype.emitEvent = function(name, attributes, userdata) { | ||
var message = { | ||
@@ -102,4 +105,2 @@ seq: 1, | ||
V8Debug.prototype.mirror = binding.mirror; | ||
V8Debug.prototype.commandToEvent = function(request, response) { | ||
@@ -113,2 +114,7 @@ response.type = 'event'; | ||
V8Debug.prototype.registerEvent = function(name) { | ||
this._processor.extendedProcessDebugJSONRequestHandles_[name] = this.commandToEvent; | ||
}; | ||
V8Debug.prototype.get = | ||
V8Debug.prototype.runInDebugContext = function(script) { | ||
@@ -115,0 +121,0 @@ if (typeof script == 'function') script = script.toString() + '()'; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12211
125
58