(url)
| 100 | }) |
| 101 | } |
| 102 | function httpGetJson(url) { |
| 103 | return new Promise((res, rej) => { |
| 104 | const req = http.get(url, (r) => { let b = ''; r.on('data', (c) => (b += c)); r.on('end', () => { try { res(JSON.parse(b)) } catch (e) { rej(e) } }) }) |
| 105 | req.on('error', rej); req.setTimeout(1000, () => req.destroy(new Error('timeout'))) |
| 106 | }) |
| 107 | } |
| 108 | class Cdp { |
| 109 | constructor(url) { this.url = url; this.id = 1; this.pending = new Map(); this.listeners = new Map() } |
| 110 | connect() { |
no test coverage detected