Task scheduling and workers: defer work, run deferrable Tasks, and hand jobs to other threads.
npm install @tsdotnet/threadingimport { 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 readstart() schedules a Task to run later, and Worker hands work to another thread.
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.