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.
![Coverage Status](https://coveralls.io/repos/github/allegiant-js/shutdown/badge.svg?branch=master)
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);
if (live !== false) {
clearInterval(live);
finished();
}
}
live = setInterval(function () {
console.log("tick");
}, 1000);
process.on('finished', function() {
console.log("finish triggered");
});
Copyright & License
Copyright © 2017 Allegiant. Distributed under the terms of the MIT License, see LICENSE
Availble via npm or github.