@allnulled/runtime
v1.0.0
Published
Spawns new processes from JavaScript functions.
Downloads
8
Readme
@allnulled/runtime
Spawns new processes from JavaScript functions.
Installation
npm i -s @allnulled/runtimeUsage
This script spawns 3 different processes:
const Runtime = require("@allnulled/runtime");
Runtime.start(() => {
setInterval(() => {
console.log("go 1");
}, 1000);
});
Runtime.start(() => {
setInterval(() => {
console.log("go 2");
}, 1000);
});
Runtime.start(() => {
setInterval(() => {
console.log("go 3");
}, 1000);
});Things to now:
- The scripts are saved automatically under
runtimesfolder (fromprocess.cwd), each of them with its own id.- Change the second parameter to another path if you prefer other folder.
- The functions (or callbacks, it does not matter) must not provide any parameter, as it is going to run in a separated different process.
- The scripts are headed with events to remove the file itself when the process is over.
