0.0.13 • Published 4 years ago

dream-jobs v0.0.13

Weekly downloads
39
License
-
Repository
github
Last release
4 years ago

Build Status

Offload computationally heavy tasks to Web Workers in supported browsers

Unsupported browsers will run the jobs on the main thread automatically

Examples

const AddNumbers = new Job(function(args) {
	let sum = 0;
	for(const arg of args) {
		sum += arg;
	}
	return sum;
});

AddNumbers
	.RunWith([1, 2, 3, 4, 5])
	.then(function(sum) {
		console.log(sum);
	});
const NthFibonacci = new Job(function(n) {
	const one = BigInt(1);
	if(n <= 2) return one;
	let a = one, b = one;

	for(let i = 2;i < n; i++) b = a + (a = b);

	return b;
});

NthFibonacci
	.RunWith(10)
	.then(function(nthFibonacci) {
		console.log(nthFibonacci);
	});

NthFibonacci
	.RunWith(10000)
	.then(function(nthFibonacci) {
		console.log(nthFibonacci);
	});
0.0.13

4 years ago

0.0.12

4 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago