UNPKG

funthreads

Version:

A lightweight tool built on top of Node.js worker_threads, enabling multithreading.

13 lines (9 loc) 236 B
const { executeInThread } = require('funthreads'); async function calculate() { const values = await Promise.all([ executeInThread(() => 2 ** 10), executeInThread(() => 3 ** 10), ]); console.log(values); } calculate();