Current section

Files

Jump to
caffeine_lang src caffeine_lang_ffi.mjs
Raw

src/caffeine_lang_ffi.mjs

// js equivalent for erlang's halt. See: https://www.erlang.org/doc/apps/erts/erlang.html#halt/0
export function halt(code) {
if (typeof process !== "undefined" && process.exit) {
// Node.js / Deno
process.exit(code);
} else if (typeof Deno !== "undefined") {
// Deno alternative
Deno.exit(code);
}
// Browser or other environments - can't really exit
return undefined;
}