Class ShutdownHook

Description

Shutdown hook implementation for Node.JS

Example

import { ShutdownHook } from '@biorate/shutdown-hook';
import { timer } from '@biorate/tools';

ShutdownHook.subscribe(async (reason) => {
await timer.wait(100);
console.log(reason); // 'SIGINT'
});

process.kill(process.pid, 'SIGINT');

Hierarchy

  • ShutdownHook

Constructors

Properties

#code: number = 0

Description

Exit code

#inProcess: boolean = false

Description

Is shutdown in process

#isShutdown: boolean = false

Description

Is shutdown complete

#hooks: Set<IHook> = ...

Description

Hooks registry

#instance: ShutdownHook

Description

Singleton instance ref

Methods

Generated using TypeDoc