2018-08-02 13:31:05 +00:00
|
|
|
# @pushrocks/smartspawn
|
|
|
|
|
2016-09-28 12:22:23 +00:00
|
|
|
smart subprocess handling
|
|
|
|
|
|
|
|
## Availabililty
|
2018-08-02 13:31:05 +00:00
|
|
|
|
2017-03-03 19:55:54 +00:00
|
|
|
[![npm](https://pushrocks.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/smartipc)
|
|
|
|
[![git](https://pushrocks.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/smartipc)
|
|
|
|
[![git](https://pushrocks.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/pushrocks/smartipc)
|
|
|
|
[![docs](https://pushrocks.gitlab.io/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/smartipc/)
|
2016-09-28 12:22:23 +00:00
|
|
|
|
|
|
|
## Status for master
|
2018-08-02 13:31:05 +00:00
|
|
|
|
2017-03-03 19:55:54 +00:00
|
|
|
[![build status](https://GitLab.com/pushrocks/smartipc/badges/master/build.svg)](https://GitLab.com/pushrocks/smartipc/commits/master)
|
|
|
|
[![coverage report](https://GitLab.com/pushrocks/smartipc/badges/master/coverage.svg)](https://GitLab.com/pushrocks/smartipc/commits/master)
|
|
|
|
[![npm downloads per month](https://img.shields.io/npm/dm/smartipc.svg)](https://www.npmjs.com/package/smartipc)
|
2016-09-28 12:22:23 +00:00
|
|
|
[![Dependency Status](https://david-dm.org/pushrocks/smartipc.svg)](https://david-dm.org/pushrocks/smartipc)
|
|
|
|
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/smartipc/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/smartipc/master/dependencies/npm)
|
|
|
|
[![bitHound Code](https://www.bithound.io/github/pushrocks/smartipc/badges/code.svg)](https://www.bithound.io/github/pushrocks/smartipc)
|
|
|
|
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
|
|
|
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
|
|
|
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
|
|
|
|
|
2017-03-03 19:55:54 +00:00
|
|
|
## Usage
|
2018-08-02 13:31:05 +00:00
|
|
|
|
2017-03-03 19:55:54 +00:00
|
|
|
Use TypeScript for best in class instellisense.
|
|
|
|
|
|
|
|
### Understand the Purpose
|
2018-08-02 13:31:05 +00:00
|
|
|
|
2016-09-28 12:22:23 +00:00
|
|
|
smartipc makes it easy to spawn tasks into subprocesses without loosing control over what those processes do.
|
|
|
|
You can transparently call functions and expect returned data using promises.
|
|
|
|
|
2017-03-03 19:55:54 +00:00
|
|
|
### How To
|
2016-09-28 12:22:23 +00:00
|
|
|
|
2017-01-29 22:46:09 +00:00
|
|
|
**Master.ts:**
|
2016-09-28 12:22:23 +00:00
|
|
|
|
2017-01-29 22:46:09 +00:00
|
|
|
```javascript
|
2018-08-02 13:31:05 +00:00
|
|
|
import * as smartspawn from 'smartspawn';
|
|
|
|
smartspawn.setBasePathArg(__dirname); // if you want to avoid typings out full paths every time
|
2016-09-28 12:22:23 +00:00
|
|
|
|
2018-08-02 13:31:05 +00:00
|
|
|
let myThread = new smartspawn.Thread('worker');
|
2017-01-29 22:46:09 +00:00
|
|
|
myThread.send('someMessageOrObject').then(messageResponse => {
|
2018-08-02 13:31:05 +00:00
|
|
|
console.log(messageResponse);
|
|
|
|
});
|
2016-09-28 12:22:23 +00:00
|
|
|
```
|
|
|
|
|
2017-01-29 22:46:09 +00:00
|
|
|
**worker.ts**
|
2016-09-28 12:22:23 +00:00
|
|
|
|
2017-01-29 22:46:09 +00:00
|
|
|
```javascript
|
2016-09-28 12:23:47 +00:00
|
|
|
```
|
2017-03-03 19:55:54 +00:00
|
|
|
|
|
|
|
For further information read the linked docs at the top of this README.
|
|
|
|
|
|
|
|
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
2018-08-02 13:31:05 +00:00
|
|
|
> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
2017-03-03 19:55:54 +00:00
|
|
|
|
|
|
|
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks)
|