multi-thread.js

0.0.1 • Public • Published

thread.js

Add Java-like multi-threading to node.js applications, without having to write a separate file.

Usage

Thread.js has one method that you pass a function to. It will then run that function on a separate thread.

var threadjs = require('thread.js');
threadjs.runTask(function () {
  for (var i = 0; i < 100000, i++) {
  }

  console.log("Done.");
});

How Does it Work?

The runTask method converts the passed-in function into a string. And then, it will spawn a new node.js process, with the function's string as a command-line argument.

Readme

Keywords

none

Package Sidebar

Install

npm i multi-thread.js

Weekly Downloads

1

Version

0.0.1

License

none

Last publish

Collaborators

  • manlycoffee