Skip to content

Perlover/async-exit-hook

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

exit-hook Build Status

Run some code when the process exits

The process.on('exit') event doesn't catch all the ways a process can exit.

Useful for cleaning up.

Install

$ npm install --save exit-hook

Usage

const exitHook = require('exit-hook');

exitHook(() => {
	console.log('exiting');
});

// you can add multiple hooks, even across files
exitHook(() => {
	console.log('exiting 2');
});

throw new Error('unicorns');

//=> 'exiting'
//=> 'exiting 2'

License

MIT © Sindre Sorhus

About

Run some code when the process exits

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%