Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including iproc with all npm packages installed. Try it out:

var iproc = require("iproc")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

iproc v5.1.2

Process simulation using web workers. (tiny-worker)

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)

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free