How do you add a callback for the program exiting?
Implementation in nodejs:
process.on('exit', function (){
console.log('Goodbye!');
});
How do you add a callback for the program exiting?
Implementation in nodejs:
process.on('exit', function (){
console.log('Goodbye!');
});
You can use unload
globalThis.addEventListener("unload", () => {
console.log('goodbye!');
});
setTimeout(() => console.log('before goodbye'), 1000);
It'll be triggered when calling Deno.exit()
as well. You can check more about Program Lifecycle here.
© 2022 - 2024 — McMap. All rights reserved.