2.0.0 • Published 6 years ago

capture-exit v2.0.0

Weekly downloads
10,087,698
License
ISC
Repository
github
Last release
6 years ago

capture-exit

Build status Build Status

Allow cooprative async exit handlers, we unfortunately must hijack process.exit.

It allows a handler to ensure exit, without that exit handler impeding other similar handlers

for example, see: sindresorhus/ora#27

Differences between process.on('exit') and captureExit.onExit(...) => https://github.com/ember-cli/capture-exit/issues/12

Installation

yarn add capture-exit
// or
npm install --save capture-exit

Usage

// as early in startup as possible
require('capture-exit').captureExit();

// when you want to schedule some work on exit:
function onExit() {
  return something.processWillExit(); // you can return promises, which will pause exit until fulfilled
}

require('capture-exit').onExit(onExit); // add an exit handler
require('capture-exit').offExit(onExit); // allows one to remove an exit handle if it is not longer required
sanearchetype-libraryreact-native-bluetooth2killi8n-react-native-fast-imagern-send-smsspecify-importsbabel-specify-imports@icanpm/api-masterreact-native-template-rfbaseairscanairscan-examplereact-native-esc-pos-sahaab@borisovart/atol-kkt-moduledeneme323112@ntt_app/react-native-custom-notificationreact-native-custom-text-hwjamesregeniereact-native-covid-sdkgql_din_modreact-native-thanh-toast-library@thanhnguyen14797/react-native-thanh-toast-libraryreact-native-printer-brothersrn-pdf-reader-offlinewilscanner@mink-opn/build-tokensreact-native-slider-kf@infinitebrahmanuniverse/nolb-capt@saaspe/componentsplginexpand-react-bridge@everything-registry/sub-chunk-1294tailwind-vector-effectsyncbackbasestest-library-123webchewoven-challenge-deploysuperset-plugin-chart-hello-world2supercluster-googlemaps-adapter-clonesspotify-ds-sestp-cdktestapatestnpm_lmnsvelte-component-libvision-camera-plugin-scan-faces@donapot/mylibtest@coboxcoop/seeder@cryptocode99/token-lists@cute-apocalypse/react-tree@corelmax/react-native-my2c2p-sdk@blkmarketco/components-library@rps-engine/core@percent/percent-api-hooks@poscredit/plugin-chart-boris@routebuddies/react-native-mapbox-navigationjnf-accesscontrol-rnttllayer-gendfeuk-frontenddfeuk-frontend-manualsushi-sdk-ftmstringlbtypeorm-polymorphic-cloneu-librarytwine-libtwine-library@apardellass/react-native-audio-stream@ansonhkg/utils@asiz33/smartblok-vendure-plugin@arielapaula/components@arielapaula/test@adpt/utils@affinidi/affinidi-auth-sdk-kernel@alexshmyrkov/react-ranger@behzadebrhm/utils@batbayar/superset-plugin-chart-hello-world@bezael-challenge/innoit-date-format@bhzdbash/utils@catalinaquinteror/mdlinks@bonsaiswapv3/core@bonsaiswapv3/deploy@deep27/supersetpluginchart-helloworldvue-v3-yandex-metrikawarmaitech-gpt-3-encoderts-reactx@felipesimmi/react-native-datalogic-module@edecamps/react-native-animated-code-input@gzup/react-image-file-resizer@hawkingnetwork/react-native-tab-view@hbglobal/react-native-actions-shortcuts@hazyflame/vue-jitsi-meet@hproinformatica/functions@humanity.cash/types@geeky-apo/react-native-advanced-clipboard@eliteswap/token-lists@frat/sane@innodata/vue-v3-ya-metrika@lanz1/v-money3@lego-js/tests@inti-ar/evm-chains@meysam213/react-leaflet@maricode1111/date-lib
2.0.0

6 years ago

1.2.0

8 years ago

1.1.0

8 years ago

1.0.7

9 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago