Skip to content

allegiant-js/shutdown

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shutdown

Simple graceful shutdown helper library.

There be 🐲 here! The API and functionality are being cemented, anything before a 1.0.0 release is subject to change.

Npm Version Build Status Coverage Status

Installation

npm install @allegiant/shutdown --save

Usage

const Shutdown = require('@allegiant/shutdown');

var live=false;

Shutdown(onShutdown);
function onShutdown(req=false, finished) {
    console.log("Shut down triggered... ", req); // eslint-disable-line
    if (live !== false) {
        clearInterval(live);
        finished();
    }
}

live = setInterval(function () { 
    console.log("tick"); // eslint-disable-line
}, 1000); 

process.on('finished', function() {
    console.log("finish triggered"); // eslint-disable-line
});

Copyright & License

Copyright © 2017 Allegiant. Distributed under the terms of the MIT License, see LICENSE

Availble via npm or github.

About

Simple graceful shutdown helper library.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published