iproc
Process simulation using web workers. (tiny-worker)
Last updated 3 years ago by cryogena .
ISC · Original npm · Tarball · package.json
$ cnpm install iproc 
SYNC missed versions from official npm registry.

Node module to simulate processes.

Usage:

var iproc=require("iproc");
var proc=iproc();

// create a process - pid returned
var pid=proc.create({
    exec:function(){
        /*code here*/
        self.onmessage=function(ev){
            // ev.data = message
            postMessage("/*message back to main process*/");
        };
    },
    autostart:(true|false),
    name:"process name",
    onmessage:function(ev){/*ev.data is the message*/}
});

// start a process via pid
proc.start(pid);

// stop an active process via pid
proc.stop(pid);

// stop and kill a process via pid
proc.destroy(pid);

// send message to process
proc.message(pid,message);

// get info on a pid
proc.info(pid);

// list active processes pids
proc.list();

Since last publish, I have completely reworked the system, not it only takes a function, (it can take a filepath if needed)

Current Tags

  • 5.1.2                                ...           latest (3 years ago)

2 Versions

  • 5.1.2                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 3
Last Day 0
Last Week 2
Last Month 1
Dependencies (1)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |