1.1.0 • Published 8 months ago

finally-provider v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

Finally Provider

Register functions for execution at a later time.

Installation

npm i finally-provider

Usage

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.");
});

Known issues

Related work

License

MIT