@hyrious/blivec
Advanced tools
Comparing version 0.3.13 to 0.3.14
@@ -258,3 +258,3 @@ #!/usr/bin/env node | ||
} | ||
choices.push("Y=1", "max", "n"); | ||
choices.push("Y=1", "max", "n", "retry"); | ||
const repl2 = setup_repl(); | ||
@@ -275,2 +275,4 @@ const answer = await new Promise((resolve) => { | ||
break; | ||
case "r": | ||
return "retry"; | ||
} | ||
@@ -324,2 +326,6 @@ } | ||
} | ||
if (selected === "retry") { | ||
await replay(initial); | ||
return; | ||
} | ||
if (!selected) | ||
@@ -330,5 +336,3 @@ process.exit(0); | ||
con ||= listen(id2); | ||
con.resume(); | ||
child.on("exit", () => { | ||
con.pause(); | ||
if (!(on_close === "quit" || on_close === "exit")) { | ||
@@ -335,0 +339,0 @@ log.info('to exit, press "Ctrl+C" in the console'); |
@@ -37,5 +37,2 @@ import { Socket } from 'net'; | ||
constructor(roomId: number, events?: Events); | ||
_temp: any[] | null; | ||
pause(): void; | ||
resume(): void; | ||
_closed: boolean; | ||
@@ -42,0 +39,0 @@ _connect_index: number; |
@@ -56,15 +56,2 @@ "use strict"; | ||
timer_heartbeat = /* @__PURE__ */ setTimeout(noop); | ||
_temp = null; | ||
pause() { | ||
this._temp || (this._temp = []); | ||
} | ||
resume() { | ||
const temp = this._temp; | ||
if (temp) { | ||
this._temp = null; | ||
for (const data of temp) { | ||
(this.events.message || noop)(data); | ||
} | ||
} | ||
} | ||
_closed = false; | ||
@@ -155,7 +142,3 @@ _connect_index = 0; | ||
} else if (type === "message") { | ||
if (this._temp) { | ||
this._temp.push(data); | ||
} else { | ||
(this.events.message || noop)(data); | ||
} | ||
(this.events.message || noop)(data); | ||
} | ||
@@ -162,0 +145,0 @@ } |
{ | ||
"name": "@hyrious/blivec", | ||
"version": "0.3.13", | ||
"version": "0.3.14", | ||
"description": "bilibili live cli", | ||
@@ -21,3 +21,3 @@ "type": "module", | ||
"build:js": "esbuild src/index.ts src/bin.ts --target=node16.15 --outdir=dist", | ||
"build:types": "dts src/index.ts --o dist/index.d.ts" | ||
"build:types": "dts src/index.ts -o dist/index.d.ts" | ||
}, | ||
@@ -36,7 +36,7 @@ "engines": { | ||
"devDependencies": { | ||
"@hyrious/dts": "^0.1.7", | ||
"@hyrious/dts": "^0.1.8", | ||
"@hyrious/rimraf": "^0.1.0", | ||
"@types/node": "^18.15.10", | ||
"esbuild": "^0.17.14" | ||
"esbuild": "^0.17.18" | ||
} | ||
} |
@@ -284,3 +284,3 @@ #!/usr/bin/env node | ||
} | ||
choices.push("Y=1", "max", "n"); | ||
choices.push("Y=1", "max", "n", "retry"); | ||
const repl = setup_repl(); | ||
@@ -301,2 +301,4 @@ const answer = await new Promise<string>((resolve) => { | ||
break; | ||
case "r": | ||
return "retry"; | ||
} | ||
@@ -355,2 +357,6 @@ } | ||
} | ||
if (selected === "retry") { | ||
await replay(initial); | ||
return; | ||
} | ||
if (!selected) process.exit(0); | ||
@@ -361,5 +367,3 @@ | ||
con ||= listen(id); | ||
con.resume(); | ||
child.on("exit", () => { | ||
con.pause(); | ||
if (!(on_close === "quit" || on_close === "exit")) { | ||
@@ -366,0 +370,0 @@ log.info('to exit, press "Ctrl+C" in the console'); |
@@ -88,16 +88,2 @@ import https from "https"; | ||
_temp: any[] | null = null; | ||
pause() { | ||
this._temp || (this._temp = []); | ||
} | ||
resume() { | ||
const temp = this._temp; | ||
if (temp) { | ||
this._temp = null; | ||
for (const data of temp) { | ||
(this.events.message || noop)(data); | ||
} | ||
} | ||
} | ||
_closed = false; | ||
@@ -202,7 +188,3 @@ _connect_index = 0; | ||
} else if (type === "message") { | ||
if (this._temp) { | ||
this._temp.push(data); | ||
} else { | ||
(this.events.message || noop)(data); | ||
} | ||
(this.events.message || noop)(data); | ||
} | ||
@@ -209,0 +191,0 @@ } |
61320
1774