Register functions for execution at a later time.
npm i finally-provider
Provides the ability to register functions, that should be executed before shutdown.
const finalProv = new FinallyProvider({
onError: console.log,
});
//Execute where needed
finalProv.finally(() => {
console.log("Clean up stuff here.");
});
//Execute just before shutdown
finalProv.runFinally().then(() => {
console.log("Ready to exit.");
});
MIT