perf: speed up memory batch polling
This commit is contained in:
1 parent
0d9172d761
commit
afb877a96b
10 files changed
+62
-10
No files matched your search
@@ -0,0 +1,17 @@
|
||||
let activeStream: NodeJS.WriteStream | null = null;
|
||||
|
||||
export function registerActiveProgressLine(stream: NodeJS.WriteStream): void {
|
||||
if (!stream.isTTY) return;
|
||||
activeStream = stream;
|
||||
}
|
||||
|
||||
export function clearActiveProgressLine(): void {
|
||||
if (!activeStream?.isTTY) return;
|
||||
activeStream.write("\r\x1b[2K");
|
||||
}
|
||||
|
||||
export function unregisterActiveProgressLine(stream?: NodeJS.WriteStream): void {
|
||||
if (!activeStream) return;
|
||||
if (stream && activeStream !== stream) return;
|
||||
activeStream = null;
|
||||
}
|
||||
Reference in new issue
Block a user