scroll/src/deno/mod.ts

24 lines
669 B
JavaScript
Raw Normal View History

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