simple-nodejs-threader
Advanced tools
Comparing version 0.0.2 to 0.0.3
{ | ||
"author": "Viktor Leandersson", | ||
"name": "simple-nodejs-threader", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "A simple collection of multi-threading helpers for NodeJs", | ||
@@ -10,2 +10,6 @@ "keywords": [ | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/vleandersson/simple-nodejs-threader" | ||
}, | ||
"main": "dist/bundle.js", | ||
@@ -12,0 +16,0 @@ "types": "dist/index.d.ts", |
@@ -16,3 +16,3 @@ # simple-nodejs-threader | ||
1. Create a new Process manager | ||
### Create a new Process manager | ||
@@ -23,3 +23,3 @@ ```typescript | ||
1. Create one or more processes that can run in parallel | ||
### Create one or more processes that can run in parallel | ||
@@ -46,3 +46,3 @@ ```typescript | ||
1. Add processes to the manager queue | ||
### Add processes to the manager queue | ||
@@ -53,3 +53,3 @@ ```typescript | ||
1. Await for completion | ||
### Await for completion | ||
@@ -76,1 +76,32 @@ ```typescript | ||
``` | ||
## Attach external life-cycle hooks | ||
### Example: nodemon | ||
<https://github.com/remy/nodemon/blob/HEAD/doc/events.md#Using_nodemon_as_child_process> | ||
```typescript | ||
const frontendProcess = ProcessManager.promiseSpawn( | ||
"nodemon", | ||
["path/to/file.js", "--watch", "path/to/watch"], | ||
{ | ||
stdio: ["pipe", "pipe", "pipe", "ipc"], | ||
shell: true, | ||
} | ||
); | ||
frontendProcess.child.on("message", (event) => { | ||
if (event.type === "start") { | ||
console.log("nodemon started"); | ||
} else if (event.type === "crash") { | ||
console.log("script crashed for some reason"); | ||
} | ||
}); | ||
// force a restart | ||
frontendProcess.child.send("restart"); | ||
// force a quit | ||
frontendProcess.child.send("quit"); | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
28762
103
1