@opencraw/driver 0.6.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +6 -0
- package/dist/main.esm.js +6 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -512,8 +512,10 @@ function openLineChannel(input, output, handle) {
|
|
|
512
512
|
if (typeof message.method === "string") track(answer(message));
|
|
513
513
|
else settle(message);
|
|
514
514
|
});
|
|
515
|
+
let ended = false;
|
|
515
516
|
const closed = new Promise((resolve) => {
|
|
516
517
|
lines.on("close", () => {
|
|
518
|
+
ended = true;
|
|
517
519
|
for (const waiting of pending.values()) waiting.reject(new Error("the client closed the channel"));
|
|
518
520
|
pending.clear();
|
|
519
521
|
resolve();
|
|
@@ -521,6 +523,10 @@ function openLineChannel(input, output, handle) {
|
|
|
521
523
|
});
|
|
522
524
|
return {
|
|
523
525
|
request: async (method, params) => await new Promise((resolve, reject) => {
|
|
526
|
+
if (ended) {
|
|
527
|
+
reject(new Error("the channel is closed"));
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
524
530
|
const id = nextId++;
|
|
525
531
|
pending.set(id, { resolve, reject });
|
|
526
532
|
write({ jsonrpc: "2.0", id, method, params });
|
package/dist/main.esm.js
CHANGED
|
@@ -473,8 +473,10 @@ function openLineChannel(input, output, handle) {
|
|
|
473
473
|
if (typeof message.method === "string") track(answer(message));
|
|
474
474
|
else settle(message);
|
|
475
475
|
});
|
|
476
|
+
let ended = false;
|
|
476
477
|
const closed = new Promise((resolve) => {
|
|
477
478
|
lines.on("close", () => {
|
|
479
|
+
ended = true;
|
|
478
480
|
for (const waiting of pending.values()) waiting.reject(new Error("the client closed the channel"));
|
|
479
481
|
pending.clear();
|
|
480
482
|
resolve();
|
|
@@ -482,6 +484,10 @@ function openLineChannel(input, output, handle) {
|
|
|
482
484
|
});
|
|
483
485
|
return {
|
|
484
486
|
request: async (method, params) => await new Promise((resolve, reject) => {
|
|
487
|
+
if (ended) {
|
|
488
|
+
reject(new Error("the channel is closed"));
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
485
491
|
const id = nextId++;
|
|
486
492
|
pending.set(id, { resolve, reject });
|
|
487
493
|
write({ jsonrpc: "2.0", id, method, params });
|