Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// Setting up the terminal, swtiching to the alternate screenbuffer;
term.fullscreen(true)
// Horrible hack to freeze the Node.js event-loop long enough for a user to see output;
function sleep(seconds: number) {
let msecs = seconds * 1000
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, msecs)
}
// Ensuring a clean exit, and a return to the users' expected terminal-state
function onExit() {
sleep(5)
term.fullscreen(false)
}
process.on('exit', onExit)
process.on('SIGINT', onExit)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.