Skip to content

Commit 6fb61d3

Browse files
committed
Added jest & value synchronization
1 parent 7f4d00d commit 6fb61d3

16 files changed

+5445
-899
lines changed

README.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
<a href="https://github.com/W4G1/multithreading">![Multithreading logo](https://github.com/W4G1/multithreading/assets/38042257/2069b810-c630-42a8-9312-d86990e8f7ad)
2-
31
<div align="center">
42

3+
<a href="https://multithreading.io">![Multithreading Banner](https://github.com/W4G1/multithreading/assets/38042257/33d76244-5605-4f0f-8bd8-e752ce1c8175)</a>
4+
55
<a href="https://github.com/W4G1/multithreading/blob/main/LICENSE.md">![License](https://img.shields.io/github/license/W4G1/multithreading)</a>
66
<a href="https://www.npmjs.com/package/multithreading">![Downloads](https://img.shields.io/npm/dw/multithreading?color=%238956FF)</a>
77
<a href="https://www.npmjs.com/package/multithreading?activeTab=versions">![NPM version](https://img.shields.io/npm/v/multithreading)</a>
8+
<a href="https://github.com/W4G1/multithreading">![GitHub Repo stars](https://img.shields.io/github/stars/W4G1/multithreading?logo=github&label=Star&labelColor=rgb(26%2C%2030%2C%2035)&color=rgb(13%2C%2017%2C%2023))</a>
89

910
</div>
1011

@@ -14,7 +15,7 @@ Multithreading is a tiny runtime that allows you to execute functions on separat
1415

1516
With a minified size of only 3.8kb, it has first class support for [Node.js](https://nodejs.org/), [Deno](https://deno.com/) and the [browser](https://caniuse.com/webworkers/). It can also be used with any framework or library such as [React](https://react.dev/), [Vue](https://vuejs.org/) or [Svelte](https://svelte.dev/).
1617

17-
Depending on the environment, it uses [Worker Threads](https://nodejs.org/api/worker_threads.html) or [Web Workers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API). In addition to [ES6 generators](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function*) to make multithreading as simple as possible.
18+
Depending on the environment, it uses [Worker Threads](https://nodejs.org/api/worker_threads.html) or [Web Workers](https://developer.mozilla.org/en-US/docs/Web/API/Worker). In addition to [ES6 generators](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function*) to make multithreading as simple as possible.
1819

1920
## Installation
2021

@@ -42,7 +43,7 @@ const add = threaded(function* (a, b) {
4243

4344
console.log(await add(5, 10)); // 15
4445
```
45-
The `add` function is executed on a separate thread, and the result is returned to the main thread when the function is done executing. Multiple invocations will automatically be executed in parallel on separate threads.
46+
The `add` function is executed on a separate thread, and the result is returned to the main thread when the function is done executing. Consecutive invocations will be automatically executed in parallel on separate threads.
4647

4748
#### Example with shared state
4849

jest.config.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/** @type {import('jest').Config} */
2+
module.exports = {
3+
// verbose: true,
4+
rootDir: "./test",
5+
};

nodemon.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"watch": ["."],
33
"ext": "js,ts,json",
44
"ignore": [".temp", "dist", ".rollup.cache"],
5-
"exec": "rollup -c rollup.config.worker.dev.js --configPlugin @rollup/plugin-typescript && rollup -c rollup.config.dev.js --configPlugin @rollup/plugin-typescript && node ./test/node_test.js"
5+
"exec": "rollup -c rollup.config.worker.dev.js --configPlugin @rollup/plugin-typescript && rollup -c rollup.config.dev.js --configPlugin @rollup/plugin-typescript && node ./node_test.js"
66
}

0 commit comments

Comments
 (0)