(method, params)
| 249 | } |
| 250 | |
| 251 | callMethod(method, params) { |
| 252 | return new Promise((resolve, reject) => { |
| 253 | if (!this._socket) { |
| 254 | reject(new ERR_DEBUGGER_ERROR('Use `run` to start the app again.')); |
| 255 | return; |
| 256 | } |
| 257 | const data = { id: ++this._lastId, method, params }; |
| 258 | this._pending[data.id] = (error, result) => { |
| 259 | if (error) reject(unpackError(error)); |
| 260 | else resolve(ObjectKeys(result).length ? result : undefined); |
| 261 | }; |
| 262 | const json = JSONStringify(data); |
| 263 | debuglog('> %s', json); |
| 264 | this._socket.write(encodeFrameHybi17(Buffer.from(json))); |
| 265 | }); |
| 266 | } |
| 267 | |
| 268 | _fetchJSON(urlPath) { |
| 269 | return new Promise((resolve, reject) => { |
no test coverage detected