{"name":"when-exit","repository":{"type":"git","url":"git+https://github.com/fabiospampinato/when-exit.git"},"description":"Execute a function right before the process, or the browser's tab, is about to exit.","license":"MIT","version":"2.1.4","type":"module","main":"dist/node/index.js","types":"./dist/node/index.d.ts","exports":{"node":"./dist/node/index.js","default":"./dist/browser/index.js"},"scripts":{"clean":"tsex clean","compile":"tsex compile","compile:watch":"tsex compile --watch","test":"node test/index.js","prepublishOnly":"npm run clean && npm run compile && npm run test"},"keywords":["exit","catch","event","handle","hook","intercept","signal"],"devDependencies":{"@types/node":"^18.19.70","tsex":"^4.0.2","typescript":"^5.7.3"},"_id":"when-exit@2.1.4","gitHead":"04c499274eccb4c18b2f6399b66731401c10060b","bugs":{"url":"https://github.com/fabiospampinato/when-exit/issues"},"homepage":"https://github.com/fabiospampinato/when-exit#readme","_nodeVersion":"18.19.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-4rnvd3A1t16PWzrBUcSDZqcAmsUIy4minDXT/CZ8F2mVDgd65i4Aalimgz1aQkRGU0iH5eT5+6Rx2TK8o443Pg==","shasum":"e2a0e998f7ad67eb0d2ce37e9794386663cc96f7","tarball":"http://registry-npm.ywwl.com/when-exit/download/when-exit-2.1.4.tgz","fileCount":17,"unpackedSize":6902,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCFfjR//KU/jcs1bD2tncYVg4jYX6Ve++WnkvkHVp2YRwIgXeGSBpkP8reNKVIQwktMSGvOjfQ9LCkD9XMEvt/KtzY="}],"size":2815,"noattachment":false,"key":"/when-exit/-/when-exit-2.1.4.tgz"},"_npmUser":{"name":"fabiospampinato","email":"spampinabio@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/when-exit_2.1.4_1736706921582_0.5617467081559211"},"_hasShrinkwrap":false,"readme":"# WhenExit\n\nExecute a function right before the process, or the browser's tab, is about to exit.\n\n## Install\n\n```sh\nnpm install when-exit\n```\n\n## Usage\n\n```ts\nimport whenExit from 'when-exit';\n\n// Registering multiple callbacks\n\nonExit ( () => {\n  console.log ( 'Callback 1' );\n});\n\nonExit ( () => {\n  console.log ( 'Callback 2' );\n});\n\n// Registering and disposing a callback\n\nconst disposer = onExit ( () => {\n  console.log ( 'Callback 3' );\n});\n\ndisposer ();\n\n// Triggering the process to exit\n\nprocess.exit (); // Callback 1 and 2 are called before exiting\n```\n\n## License\n\nMIT © Fabio Spampinato\n","publish_time":1736706921780,"maintainers":[{"name":"fabiospampinato","email":"spampinabio@gmail.com"}],"_cnpm_publish_time":1736706921780,"dist-tags":{"latest":"2.1.5"}}