{"_id":"when-exit","_rev":"4106790","name":"when-exit","description":"Execute a function right before the process, or the browser's tab, is about to exit.","dist-tags":{"latest":"2.1.5"},"maintainers":[{"name":"fabiospampinato","email":"spampinabio@gmail.com"}],"time":{"modified":"2026-01-11T18:56:35.000Z","created":"2022-02-08T21:14:56.204Z","2.1.5":"2025-10-28T22:52:37.076Z","2.1.4":"2025-01-12T18:35:21.780Z","2.1.3":"2024-06-30T13:49:15.795Z","2.1.2":"2023-12-09T23:50:49.205Z","2.1.1":"2023-08-03T17:37:40.023Z","2.1.0":"2023-02-15T00:50:09.381Z","2.0.0":"2022-04-06T00:11:25.767Z","1.0.0":"2022-02-08T21:14:56.204Z"},"users":{},"repository":{"type":"git","url":"git+https://github.com/fabiospampinato/when-exit.git"},"versions":{"2.1.5":{"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.5","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.5","gitHead":"b6f255cd6078fcca1593e7b6f7d211e2ab25a1b4","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":{"shasum":"53fa4ffa2ba4c792213fb6617eb7d08f0dcb1a9f","size":2811,"noattachment":false,"key":"/when-exit/-/when-exit-2.1.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/when-exit/download/when-exit-2.1.5.tgz"},"_npmUser":{"name":"fabiospampinato","email":"spampinabio@gmail.com"},"directories":{},"maintainers":[{"name":"fabiospampinato","email":"spampinabio@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/when-exit_2.1.5_1761691956889_0.02036148488677303"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-10-28T22:52:37.076Z","publish_time":1761691957076,"_source_registry_name":"default","_cnpm_publish_time":1761691957076},"2.1.4":{"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":{"shasum":"e2a0e998f7ad67eb0d2ce37e9794386663cc96f7","size":2815,"noattachment":false,"key":"/when-exit/-/when-exit-2.1.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/when-exit/download/when-exit-2.1.4.tgz"},"_npmUser":{"name":"fabiospampinato","email":"spampinabio@gmail.com"},"directories":{},"maintainers":[{"name":"fabiospampinato","email":"spampinabio@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/when-exit_2.1.4_1736706921582_0.5617467081559211"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-01-12T18:35:21.780Z","publish_time":1736706921780,"_source_registry_name":"default","_cnpm_publish_time":1736706921780},"2.1.3":{"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.","version":"2.1.3","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.13.0","tsex":"^3.0.0","typescript":"^5.1.6"},"_id":"when-exit@2.1.3","gitHead":"bbe129f6fbb84190e79a9bd2fc246b40bfa17da6","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":{"shasum":"5831cdbed8ad4984645da98c4a00d4ee3a3757e7","size":4001,"noattachment":false,"key":"/when-exit/-/when-exit-2.1.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/when-exit/download/when-exit-2.1.3.tgz"},"_npmUser":{"name":"fabiospampinato","email":"spampinabio@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/when-exit_2.1.3_1719755355632_0.04754522859264143"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-06-30T13:49:15.795Z","publish_time":1719755355795,"_source_registry_name":"default","maintainers":[{"name":"fabiospampinato","email":"spampinabio@gmail.com"}],"_cnpm_publish_time":1719755355795},"2.1.2":{"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.","version":"2.1.2","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.13.0","tsex":"^3.0.0","typescript":"^5.1.6"},"_id":"when-exit@2.1.2","gitHead":"00fc9cec8b8f61a652b944bcb707d59851a7085b","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":{"shasum":"888d8af6770e2b772fa3677aba1aff1a54320511","size":3950,"noattachment":false,"key":"/when-exit/-/when-exit-2.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/when-exit/download/when-exit-2.1.2.tgz"},"_npmUser":{"name":"fabiospampinato","email":"spampinabio@gmail.com"},"directories":{},"maintainers":[{"name":"fabiospampinato","email":"spampinabio@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/when-exit_2.1.2_1702165848973_0.28250636189738976"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-12-09T23:50:49.205Z","publish_time":1702165849205,"_source_registry_name":"default","_cnpm_publish_time":1702165849205},"2.1.1":{"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.","version":"2.1.1","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.13.0","tsex":"^3.0.0","typescript":"^5.1.6"},"gitHead":"e798252aaea6e0835cdff35137d00df1e5d6972b","bugs":{"url":"https://github.com/fabiospampinato/when-exit/issues"},"homepage":"https://github.com/fabiospampinato/when-exit#readme","_id":"when-exit@2.1.1","_nodeVersion":"18.12.0","_npmVersion":"8.19.2","dist":{"shasum":"08df6c5dafaf3d233ad153990d8a24d941bbe801","size":3787,"noattachment":false,"key":"/when-exit/-/when-exit-2.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/when-exit/download/when-exit-2.1.1.tgz"},"_npmUser":{"name":"fabiospampinato","email":"spampinabio@gmail.com"},"directories":{},"maintainers":[{"name":"fabiospampinato","email":"spampinabio@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/when-exit_2.1.1_1691084259825_0.6819902852711528"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-08-03T17:37:40.023Z","publish_time":1691084260023,"_source_registry_name":"default","_cnpm_publish_time":1691084260023},"2.1.0":{"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.","version":"2.1.0","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.13.0","tsex":"^2.1.0","typescript":"^4.9.5"},"gitHead":"756d4544da093545efbd9b25c4771202f6e73be7","bugs":{"url":"https://github.com/fabiospampinato/when-exit/issues"},"homepage":"https://github.com/fabiospampinato/when-exit#readme","_id":"when-exit@2.1.0","_nodeVersion":"18.12.0","_npmVersion":"8.19.2","dist":{"shasum":"0f7b5d7d5f00ea2c4b131b546c444cca2c4ffba7","size":3830,"noattachment":false,"key":"/when-exit/-/when-exit-2.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/when-exit/download/when-exit-2.1.0.tgz"},"_npmUser":{"name":"fabiospampinato","email":"spampinabio@gmail.com"},"directories":{},"maintainers":[{"name":"fabiospampinato","email":"spampinabio@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/when-exit_2.1.0_1676422209230_0.7089505602227204"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-02-15T00:50:09.381Z","publish_time":1676422209381,"_cnpm_publish_time":1676422209381},"2.0.0":{"name":"when-exit","repository":{"type":"git","url":"git+https://github.com/fabiospampinato/when-exit.git"},"description":"Execute a function right before the process is about to exit.","version":"2.0.0","type":"module","main":"dist/index.js","exports":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"clean":"tsex clean","compile":"tsex compile","compile:watch":"tsex compile --watch","test":"node test/index.js","prepublishOnly":"npm run clean && npm run compile"},"keywords":["exit","catch","event","handle","hook","intercept","signal"],"devDependencies":{"@types/node":"^17.0.23","tsex":"^1.0.4","typescript":"^4.6.3"},"gitHead":"29d133b974afee7ae258bc576aee5f043411427d","bugs":{"url":"https://github.com/fabiospampinato/when-exit/issues"},"homepage":"https://github.com/fabiospampinato/when-exit#readme","_id":"when-exit@2.0.0","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"shasum":"e5a4f30dbb8a6a8382490cd0718807357e7b98fe","size":3188,"noattachment":false,"key":"/when-exit/-/when-exit-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/when-exit/download/when-exit-2.0.0.tgz"},"_npmUser":{"name":"fabiospampinato","email":"spampinabio@gmail.com"},"directories":{},"maintainers":[{"name":"fabiospampinato","email":"spampinabio@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/when-exit_2.0.0_1649203885617_0.9402367947039494"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-04-06T00:14:18.187Z","publish_time":1649203885767,"_cnpm_publish_time":1649203885767},"1.0.0":{"name":"when-exit","description":"Execute a function right before the process is about to exit.","version":"1.0.0","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"clean":"rimraf dist","compile":"tsc --skipLibCheck && tstei","compile:watch":"tsc --skipLibCheck --watch","test":"node test/index.js","prepublishOnly":"npm run clean && npm run compile"},"bugs":{"url":"https://github.com/fabiospampinato/when-exit/issues"},"license":"MIT","author":{"name":"Fabio Spampinato","email":"spampinabio@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/fabiospampinato/when-exit.git"},"keywords":["exit","catch","event","handle","hook","intercept","signal"],"devDependencies":{"@types/node":"^17.0.16","rimraf":"^3.0.2","typescript":"^4.5.5","typescript-transform-export-interop":"^1.0.4"},"gitHead":"8bb773c0c50088e2e63ee9e6354f29857b334e22","homepage":"https://github.com/fabiospampinato/when-exit#readme","_id":"when-exit@1.0.0","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"shasum":"664845bdd3591b9b657ce40d830e61599aa5c304","size":3843,"noattachment":false,"key":"/when-exit/-/when-exit-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/when-exit/download/when-exit-1.0.0.tgz"},"_npmUser":{"name":"fabiospampinato","email":"spampinabio@gmail.com"},"directories":{},"maintainers":[{"name":"fabiospampinato","email":"spampinabio@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/when-exit_1.0.0_1644354896074_0.9620101716198008"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-02-08T21:15:00.809Z","publish_time":1644354896204,"_cnpm_publish_time":1644354896204}},"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","_attachments":{},"homepage":"https://github.com/fabiospampinato/when-exit#readme","bugs":{"url":"https://github.com/fabiospampinato/when-exit/issues"},"license":"MIT"}