2023-10-27 16:02:54 -04:00
|
|
|
/**
|
|
|
|
* The main entrypoint when using Deno as the runtime
|
|
|
|
*/
|
2023-11-10 18:22:09 -05:00
|
|
|
import { IRuntime, RunTimeType } from '../common/mod.ts';
|
|
|
|
import DenoTerminalIO from './terminal_io.ts';
|
2023-11-13 15:33:56 -05:00
|
|
|
import DenoFileIO from './file_io.ts';
|
2023-10-27 16:02:54 -04:00
|
|
|
|
2023-11-08 15:53:14 -05:00
|
|
|
const DenoRuntime: IRuntime = {
|
2023-11-10 18:22:09 -05:00
|
|
|
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) =>
|
2023-11-16 11:10:33 -05:00
|
|
|
globalThis.addEventListener(eventName, handler),
|
2023-11-10 18:22:09 -05:00
|
|
|
onExit: (cb: () => void): void => {
|
|
|
|
globalThis.addEventListener('onbeforeunload', cb);
|
|
|
|
},
|
|
|
|
exit: (code?: number) => Deno.exit(code),
|
2023-11-08 15:53:14 -05:00
|
|
|
};
|
2023-11-06 18:49:29 -05:00
|
|
|
|
2023-11-08 15:53:14 -05:00
|
|
|
export default DenoRuntime;
|