chrome-remote-multiplex
Advanced tools
Comparing version 0.1.6 to 0.1.8
@@ -632,2 +632,7 @@ 'use strict'; | ||
/** | ||
* Starts the HTTP server | ||
*/ | ||
_createClass(MultiplexServer, [{ | ||
@@ -701,3 +706,3 @@ key: 'listen', | ||
// Gets JSON from the remote server and copies it to the client | ||
// Gets data from the remote server and copies it to the client | ||
function copyToClient(req, res) { | ||
@@ -790,3 +795,3 @@ return httpGet({ | ||
var webServer = Http.createServer(app); | ||
var webServer = this.webServer = Http.createServer(app); | ||
var proxies = this._proxies = {}; | ||
@@ -861,4 +866,4 @@ | ||
value: function close() { | ||
this.express.close(); | ||
this.express = null; | ||
this.webServer.close(); | ||
this.webServer = null; | ||
} | ||
@@ -932,2 +937,55 @@ | ||
/** | ||
* API for remote control of the MultiplexServer | ||
*/ | ||
exports.default = MultiplexServer; | ||
var ClientApi = exports.ClientApi = function () { | ||
function ClientApi(options) { | ||
_classCallCheck(this, ClientApi); | ||
options = options || {}; | ||
var remoteClient = options.remoteClient; | ||
if (remoteClient !== undefined) { | ||
var m = remoteClient.match(/^([^:]+)(:([0-9]+))?$/); | ||
if (m) { | ||
options.remoteClientHostname = m[1]; | ||
options.remoteClientPort = m[3]; | ||
} else { | ||
throw new Error("Cannot interpret remoteClient - found " + remoteClient + ", expected something like 'localhost:9222'"); | ||
} | ||
} | ||
this.options = { | ||
remoteClientHostname: options.remoteClientHostname || "localhost", | ||
remoteClientPort: options.remoteClientPort || 9222 | ||
}; | ||
this.options.remoteClient = this.options.remoteClientHostname + ":" + this.options.remoteClientPort; | ||
} | ||
/** | ||
* Enables auto close for a specific target | ||
*/ | ||
_createClass(ClientApi, [{ | ||
key: 'autoClose', | ||
value: function autoClose(id) { | ||
var t = this; | ||
return httpGet({ | ||
hostname: t.options.remoteClientHostname, | ||
port: t.options.remoteClientPort, | ||
path: '/json/auto-close/' + id, | ||
method: 'GET' | ||
}).then(function (obj) { | ||
res.send(obj.data); | ||
return obj.data; | ||
}); | ||
} | ||
}]); | ||
return ClientApi; | ||
}(); | ||
/** | ||
* Does a simple HTTP GET | ||
@@ -938,3 +996,2 @@ * @return Promise - payload is the response context | ||
exports.default = MultiplexServer; | ||
function httpGet(options) { | ||
@@ -941,0 +998,0 @@ return new Promise(function (resolve, reject) { |
{ | ||
"name": "chrome-remote-multiplex", | ||
"version": "0.1.6", | ||
"version": "0.1.8", | ||
"description": "Allows multiple Chrome DevTools Clients to connect to a single Remote Debugger (ie Chrome Headless) instance", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
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
93324
901