|
@ -128,7 +128,7 @@ exports.Client = Client; |
|
|
|
|
|
|
|
|
Client.prototype._addHandle = function(desc) { |
|
|
Client.prototype._addHandle = function(desc) { |
|
|
if (typeof desc != 'object' || !desc.handle) throw new Error("bad type"); |
|
|
if (typeof desc != 'object' || !desc.handle) throw new Error("bad type"); |
|
|
this.handles[desc.id] = desc; |
|
|
this.handles[desc.handle] = desc; |
|
|
|
|
|
|
|
|
if (desc.type == 'script') { |
|
|
if (desc.type == 'script') { |
|
|
this._addScript(desc); |
|
|
this._addScript(desc); |
|
@ -208,11 +208,13 @@ Client.prototype.reqVersion = function(cb) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Client.prototype.reqEval = function(expression, cb) { |
|
|
Client.prototype.reqEval = function(expression, cb) { |
|
|
|
|
|
var self = this; |
|
|
var req = { |
|
|
var req = { |
|
|
command: 'evaluate', |
|
|
command: 'evaluate', |
|
|
arguments: { expression: expression } |
|
|
arguments: { expression: expression } |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.currentFrame == NO_FRAME) { |
|
|
if (this.currentFrame == NO_FRAME) { |
|
|
req.arguments.global = true; |
|
|
req.arguments.global = true; |
|
|
} else { |
|
|
} else { |
|
@ -220,6 +222,8 @@ Client.prototype.reqEval = function(expression, cb) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
this.req(req, function (res) { |
|
|
this.req(req, function (res) { |
|
|
|
|
|
console.error('reqEval res ', res.body); |
|
|
|
|
|
self._addHandle(res.body); |
|
|
if (cb) cb(res.body); |
|
|
if (cb) cb(res.body); |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
}; |
|
|