(i, t)
| 643 | this._mode !== 3 ? this.fetch(this._url, JSON.stringify(n)).catch((s) => this.onError(s)).then((s) => this.result(s, n)) : this._socket.send(JSON.stringify({ action: "call", body: n })); |
| 644 | } |
| 645 | result(i, t) { |
| 646 | const n = {}; |
| 647 | if (i) |
| 648 | for (let s = 0; s < i.length; s++) |
| 649 | n[i[s].id] = i[s]; |
| 650 | else |
| 651 | for (let s = 0; s < t.length; s++) |
| 652 | n[t[s].id] = { id: t[s].id, error: "Network Error", data: null }; |
| 653 | for (let s = this._queue.length - 1; s >= 0; s--) { |
| 654 | const a = this._queue[s], o = n[a.data.id]; |
| 655 | o && (this.onResponse(a, o), o.error ? a.reject(o.error) : a.resolve(o.data), this._queue.splice(s, 1)); |
| 656 | } |
| 657 | } |
| 658 | on(i, t) { |
| 659 | const n = this._uid(); |
| 660 | let s = this._events[i]; |
no test coverage detected