Package Exports
- node-persistent-software
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (node-persistent-software) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
node-persistent-software
Spawn a software and keep it running
Installation
$ npm install node-persistent-software
Doc
string software
path to the softwarestring args
arguments passed to the softwareobject process
current processboolean stopped
if stopped, keep it stoppedint maxCountRun
max start iterationint countRun
current start iterationasynchronous-eventemitter eventEmitter
async events managerconstructor(string software [, array arguments [ , object options ] ] )
=> see spawn documentationmax(int maxIteration) : return this
change max iterations and reset currentinfinite() : return this
no max iteration and reset currentstart() : return this
run the software for the first timestop() : return this
stop the software and don't restart iton("error", (err) => {}) : return this
fire if an error occurs (use try/catch to avoid loop)on("started", () => {}) : return this
fire if the software is started (or restarted)on("ended", () => {}) : return this
fire if the software is killedon("stopped", () => {}) : return this
fire if the software is stopped
Examples
const PersistantSoftware = require('node-persistent-software');
new PersistantSoftware(
"C:\\Program Files\\Mozilla Firefox\\firefox.exe",
["www.npmjs.com"]
).on("error", function(msg) {
console.log(msg);
}).on("started", function() {
console.log("software started");
}).on("ended", function() {
console.log("software ended");
}).on("stopped", function() {
console.log("software stopped");
}).infinite().start();
new PersistantSoftware(
"C:\\Program Files\\Mozilla Firefox\\firefox.exe",
["www.github.com"]
).on("error", function(msg) {
console.log(msg);
}).on("started", function() {
console.log("software started");
}).on("ended", function() {
console.log("software ended");
}).on("stopped", function() {
console.log("software stopped");
}).max(5).start();
Tests
$ gulp