scroll/src/deno/mod.ts

24 lines
661 B
JavaScript
Raw Normal View History

/**
* The main entrypoint when using Deno as the runtime
*/
2023-11-29 16:09:58 -05:00
import { IRuntime, RunTimeType } from '../common/runtime.ts';
import DenoTerminalIO from './terminal_io.ts';
2023-11-13 15:33:56 -05:00
import DenoFileIO from './file_io.ts';
2023-11-30 16:14:52 -05:00
import * as node_process from 'node:process';
const DenoRuntime: IRuntime = {
name: RunTimeType.Deno,
2023-11-13 15:33:56 -05:00
file: DenoFileIO,
term: DenoTerminalIO,
2023-11-16 13:00:02 -05:00
onEvent: (eventName: string, handler) =>
globalThis.addEventListener(eventName, handler),
onExit: (cb: () => void): void => {
globalThis.addEventListener('onbeforeunload', cb);
2023-11-30 16:14:52 -05:00
globalThis.onbeforeunload = cb;
},
2023-11-30 16:14:52 -05:00
exit: (code?: number) => node_process.exit(code),
};
2023-11-06 18:49:29 -05:00
export default DenoRuntime;