@allegiant/shutdown
v0.2.3
Published
Simple graceful shutdown helper library.
Downloads
7
Readme
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.
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