scroll/src/deno/index.ts

21 lines
416 B
JavaScript

/**
* The main entrypoint when using Deno as the runtime
*/
import { Termios } from './termios.ts'
export async function main(): Promise<number> {
const t = new Termios();
t.enableRawMode();
const decoder = new TextDecoder();
for await (const chunk of Deno.stdin.readable) {
const char = String(decoder.decode(chunk)).trim();
if (char === 'q') {
t.disableRawMode();
return 0;
}
}
return -1;
}