exit-hook

WebJar for exit-hook

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

exit-hook
Last Version

Last Version

1.1.1
Release Date

Release Date

Type

Type

jar
Description

Description

exit-hook
WebJar for exit-hook
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/sindresorhus/exit-hook

Download exit-hook

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/exit-hook/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>exit-hook</artifactId>
    <version>1.1.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/exit-hook/
implementation 'org.webjars.npm:exit-hook:1.1.1'
// https://jarcasting.com/artifacts/org.webjars.npm/exit-hook/
implementation ("org.webjars.npm:exit-hook:1.1.1")
'org.webjars.npm:exit-hook:jar:1.1.1'
<dependency org="org.webjars.npm" name="exit-hook" rev="1.1.1">
  <artifact name="exit-hook" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='exit-hook', version='1.1.1')
)
libraryDependencies += "org.webjars.npm" % "exit-hook" % "1.1.1"
[org.webjars.npm/exit-hook "1.1.1"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

exit-hook Build Status

Run some code when the process exits

The process.on('exit') event doesn't catch all the ways a process can exit.

This package is useful for cleaning up before exiting.

Install

$ npm install exit-hook

Usage

const exitHook = require('exit-hook');

exitHook(() => {
	console.log('Exiting');
});

// You can add multiple hooks, even across files
exitHook(() => {
	console.log('Exiting 2');
});

throw new Error('🦄');

//=> 'Exiting'
//=> 'Exiting 2'

Removing an exit hook:

const exitHook = require('exit-hook');

const unsubscribe = exitHook(() => {});

unsubscribe();

API

exitHook(callback)

Returns a function that removes the hook when called.

callback

Type: Function

The callback to execute when the process exits.


Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Versions

Version
1.1.1