0.4.0 • Published 3 years ago

@open-node/graceful v0.4.0

Weekly downloads
8
License
MIT
Repository
github
Last release
3 years ago

@open-node/graceful

Node.js process reload graceful

Build status codecov

Installation

Usage

  • your node.js process code

// defined loginfo handle function const info = console.log

const graceful = Graceful(info);

// get process status, false when existing unless will be true const status = graceful.enabled()

// regist callback when process exit graceful.exit(() => { // will be called when process exit });

// wrap function, Once the function is executed, the process will not exit until the function is executed const wrapped = graceful.runner(willBeWrappedFn); wrapped(); // Once the function is executed, the process will not exit until the function is executed

// graceful.runnerAsync is the asynchronous version of runner const wrapped = graceful.runner(willBeWrappedAsyncFn); await wrapped(); // Once the function is executed, the process will not exit until the function is executed

Table of Contents

Graceful

Parameters

Returns Tick Instance

exit

regist event listenner for exiting

Parameters

Returns void

runner

Wrap the function sync version. Once the be wrapped function is executed, the process will not exit until the function is executed

Parameters

Returns function Be wrapped function

runnerAsync

Wrap the function asynchronous version, Once the be wrapped function is executed, the process will not exit until the function is executed

Parameters

  • fn AsyncFunction will be wrapped fn (asynchronous)

Returns function Be warpped function

enabled

The process status

Returns boolean status

0.4.0

3 years ago

0.3.0

3 years ago

0.2.0

3 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago