hexo/node_modules/when-exit
浪子 48fea5d844 增加AI摘要 2024-05-09 16:35:20 +08:00
..
dist 增加AI摘要 2024-05-09 16:35:20 +08:00
src 增加AI摘要 2024-05-09 16:35:20 +08:00
test 增加AI摘要 2024-05-09 16:35:20 +08:00
.editorconfig 增加AI摘要 2024-05-09 16:35:20 +08:00
license 增加AI摘要 2024-05-09 16:35:20 +08:00
package.json 增加AI摘要 2024-05-09 16:35:20 +08:00
readme.md 增加AI摘要 2024-05-09 16:35:20 +08:00
tsconfig.json 增加AI摘要 2024-05-09 16:35:20 +08:00

readme.md

WhenExit

Execute a function right before the process, or the browser's tab, is about to exit.

Install

npm install --save when-exit

Usage

import whenExit from 'when-exit';

onExit ( () => {
  console.log ( 'Callback 1' );
});

onExit ( () => {
  console.log ( 'Callback 2' );
});

const disposer = onExit ( () => {
  console.log ( 'Callback 3' );
});

disposer ();

process.exit (); // Callback 1 and 2 are called before exiting

License

MIT © Fabio Spampinato