Skip to content

Commit 7d92a2c

Browse files
committed
Remove method 'registerEvent'
1 parent 2953e92 commit 7d92a2c

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

v8-debug.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ var inherits = require('util').inherits;
88
var extend = require('util')._extend;
99

1010
var NODE_NEXT = require('./tools/NODE_NEXT');
11+
var nextTmpEventId = 1;
1112

1213
// Don't cache debugger module
1314
delete require.cache[module.id];
@@ -181,8 +182,7 @@ V8Debug.prototype.registerAsyncCommand = function(name, func) {
181182
};
182183

183184
V8Debug.prototype.command =
184-
V8Debug.prototype.sendCommand =
185-
V8Debug.prototype.emitEvent = sendCommand;
185+
V8Debug.prototype.sendCommand = sendCommand;
186186
function sendCommand(name, attributes, userdata) {
187187
var message = {
188188
seq: 0,
@@ -193,6 +193,17 @@ function sendCommand(name, attributes, userdata) {
193193
binding.sendCommand(JSON.stringify(message));
194194
};
195195

196+
V8Debug.prototype.emitEvent = emitEvent;
197+
function emitEvent(name, attributes, userdata) {
198+
var handlerName = 'tmpEvent-' + nextTmpEventId++;
199+
this.registerCommand(handlerName, function(request, response) {
200+
this.commandToEvent(request, response);
201+
response.event = name;
202+
this.unregisterCommand(handlerName);
203+
}.bind(this));
204+
this.sendCommand(handlerName, attributes, userdata);
205+
}
206+
196207
V8Debug.prototype.commandToEvent = function(request, response) {
197208
response.type = 'event';
198209
response.event = response.command;
@@ -201,11 +212,6 @@ V8Debug.prototype.commandToEvent = function(request, response) {
201212
delete response.request_seq;
202213
};
203214

204-
V8Debug.prototype.registerEvent = function(name) {
205-
var proto = this._DebugCommandProcessor;
206-
proto.extendedProcessDebugJSONRequestHandles_[name] = this.commandToEvent;
207-
};
208-
209215
V8Debug.prototype.get =
210216
V8Debug.prototype.runInDebugContext = function(script) {
211217
if (typeof script == 'function') script = '(' + script.toString() + ')()';
@@ -243,8 +249,6 @@ V8Debug.prototype.enableWebkitProtocol = function() {
243249

244250
if (this._webkitProtocolEnabled) return;
245251

246-
var nextTmpEventId = 1;
247-
248252
var DebuggerScriptSource,
249253
DebuggerScript,
250254
InjectedScriptSource,

0 commit comments

Comments
 (0)