scroll/src/bun/mod.ts

23 lines
578 B
JavaScript

/**
* The main entrypoint when using Bun as the runtime
*/
import { IRuntime, RunTimeType } from '../common/mod.ts';
import BunTerminalIO from './terminal_io.ts';
import BunFileIO from './file_io.ts';
const BunRuntime: IRuntime = {
name: RunTimeType.Bun,
file: BunFileIO,
term: BunTerminalIO,
onEvent: (eventName: string, handler) => process.on(eventName, handler),
onExit: (cb: () => void): void => {
process.on('beforeExit', cb);
process.on('exit', cb);
process.on('SIGINT', cb);
},
exit: (code?: number) => process.exit(code),
};
export default BunRuntime;