{"id":22222011,"url":"https://github.com/fabiospampinato/when-exit","last_synced_at":"2025-04-09T09:06:07.239Z","repository":{"id":65412568,"uuid":"457106036","full_name":"fabiospampinato/when-exit","owner":"fabiospampinato","description":"Execute a function right before the process is about to exit.","archived":false,"fork":false,"pushed_at":"2025-01-12T18:35:26.000Z","size":17,"stargazers_count":13,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T06:08:04.846Z","etag":null,"topics":["catch","event","exit","handle","hook","intercept","signal"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fabiospampinato.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"fabiospampinato","custom":"https://www.paypal.me/fabiospampinato"}},"created_at":"2022-02-08T21:14:31.000Z","updated_at":"2025-01-12T18:35:29.000Z","dependencies_parsed_at":"2025-01-16T14:15:52.009Z","dependency_job_id":"f98e6866-7b9b-4132-aa31-144366ac58c1","html_url":"https://github.com/fabiospampinato/when-exit","commit_stats":{"total_commits":15,"total_committers":1,"mean_commits":15.0,"dds":0.0,"last_synced_commit":"00fc9cec8b8f61a652b944bcb707d59851a7085b"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Fwhen-exit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Fwhen-exit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Fwhen-exit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Fwhen-exit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fabiospampinato","download_url":"https://codeload.github.com/fabiospampinato/when-exit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248008629,"owners_count":21032556,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["catch","event","exit","handle","hook","intercept","signal"],"created_at":"2024-12-02T23:16:32.033Z","updated_at":"2025-04-09T09:06:07.218Z","avatar_url":"https://github.com/fabiospampinato.png","language":"TypeScript","funding_links":["https://github.com/sponsors/fabiospampinato","https://www.paypal.me/fabiospampinato"],"categories":[],"sub_categories":[],"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 ( () =\u003e {\n  console.log ( 'Callback 1' );\n});\n\nonExit ( () =\u003e {\n  console.log ( 'Callback 2' );\n});\n\n// Registering and disposing a callback\n\nconst disposer = onExit ( () =\u003e {\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiospampinato%2Fwhen-exit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffabiospampinato%2Fwhen-exit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiospampinato%2Fwhen-exit/lists"}