Skip to content
This repository has been archived by the owner on Oct 27, 2019. It is now read-only.

Commit

Permalink
fixed to work in the latest node
Browse files Browse the repository at this point in the history
  • Loading branch information
subtleGradient committed Oct 28, 2013
1 parent c551438 commit a010405
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions lib/HeadlessInspector.js
Expand Up @@ -10,20 +10,16 @@ exports.createHeadlessInspector = function(config, callback){
createInspectorBackend({debug:config.debug}, function(error, inspector){
if (error) {callback(error);return}

Object.keys(EventEmitter.prototype).forEach(function(key){
Object.defineProperty(inspector, key, {value:EventEmitter.prototype[key]})
})
inspector.__proto__ = EventEmitter.prototype
EventEmitter.call(inspector)
if (inspector._events) {
delete inspector._events
Object.defineProperty(inspector, '_events', {value:inspector._events})
}

initWebSocket(config.ws, function(error, ws){
if (error) {callback(error);return}
Object.defineProperty(inspector, 'socket', {value:ws})

inspector.InspectorFrontendHost.sendMessageToBackend = ws.send.bind(ws)
var sendMessageToBackend = ws.send.bind(ws)
inspector.InspectorFrontendHost.sendMessageToBackend = sendMessageToBackend

var inspector_InspectorBackend_dispatch = inspector.InspectorBackend.dispatch.bind(inspector.InspectorBackend)
ws.on('message', inspector_InspectorBackend_dispatch)
ws.on('close', function(){
Expand Down

0 comments on commit a010405

Please sign in to comment.