auto-chrome
Advanced tools
Comparing version 0.2.9 to 0.3.0
@@ -14,2 +14,3 @@ const Event = require('./Event'); | ||
this.ws = ws | ||
this.isClose = false | ||
this.ignoreHTTPSErrors = ignoreHTTPSErrors | ||
@@ -72,2 +73,3 @@ this.emulate = emulate | ||
this.isClose = true | ||
return this.send('Browser.close') | ||
@@ -74,0 +76,0 @@ |
@@ -38,5 +38,5 @@ const debug = require('debug'); | ||
return new Promise((resolve, reject) => { | ||
this.callbacks.set(id, { resolve, reject, method, error: new Error() }); | ||
this.callbacks.set(id, { resolve, reject, method }); | ||
}).catch(error => { | ||
signale.error(new Error(`messageId:${id},${error.message}`)) | ||
signale.error(id, new Error(error.message)) | ||
}) | ||
@@ -200,3 +200,5 @@ | ||
if (this.page) { | ||
this.page.send('Page.bringToFront') | ||
if (this.isClose === false) { | ||
this.page.send('Page.bringToFront') | ||
} | ||
} | ||
@@ -203,0 +205,0 @@ } |
@@ -21,3 +21,3 @@ const debug = require('debug'); | ||
*/ | ||
async send(method = '', params = {}) { | ||
send(method = '', params = {}) { | ||
@@ -33,6 +33,10 @@ let id = this.id++ | ||
return new Promise((resolve, reject) => { | ||
this.callbacks.set(id, { resolve, reject, method, error: new Error() }); | ||
this.callbacks.set(id, { resolve, reject, method }); | ||
}).catch(error => { | ||
let { code, message, data } = error | ||
signale.error(code, message, new Error(data)) | ||
if (error.code) { | ||
let { code, message, data } = error | ||
signale.error(code, message, new Error(data)) | ||
} else { | ||
signale.error(new Error(Object.values(error).toString())) | ||
} | ||
}) | ||
@@ -39,0 +43,0 @@ |
{ | ||
"name": "auto-chrome", | ||
"version": "0.2.9", | ||
"version": "0.3.0", | ||
"description": "使用Node.js操作Chrome或Chromium,高仿真的用户行为模拟器", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
566697
46
2772