Skip to content
tsdotnetPublic

About

Classes and functions for simplifying task scheduling and distributing tasks to workers.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

@tsdotnet/threading: Hand work to workers. Tasks, deferral and workers.

npm version GitHub license

Task scheduling and workers: defer work, run deferrable Tasks, and hand jobs to other threads.

Install

npm install @tsdotnet/threading

Usage

import { defer, Task } from '@tsdotnet/threading';

const later = defer(() => console.log('later'), 500);
later.cancel(); // true: it never ran

const task = new Task(() => 6 * 7);
task.result; // 42, computed on first read

start() schedules a Task to run later, and Worker hands work to another thread.

Use it from

ESM (import { defer, Task } from '@tsdotnet/threading';) or CommonJS (const { defer, Task } = require('@tsdotnet/threading');). No <script> (UMD) build: use it with a bundler or Node.js.

Docs

tsdotnet.github.io/threading

About

Classes and functions for simplifying task scheduling and distributing tasks to workers.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages