Fork a class instance into a separate thread (Node.js Worker Threads or Web Workers) while preserving TypeScript typings. v1.4.0 is stable with a mature API. Key differentiators: one-liner thread instantiation, automatic method promisification, optional auto-restart on crash, and thread pooling via ThreadedClassManager. Actively maintained with frequent releases, supports Node ≥8 and modern browsers.
npm install threadedclassNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a forked instance of Professor class running in a separate thread. Constructor arguments are passed as array; all methods become async.
Use the compiled output path (e.g., './professor.js').
Use `ThreadedClassManager.setThreadUsage(0.1)` instead of passing `threadUsage` in config.
Add `await` before calling `threadedClass()`.
Convert properties to getter methods (e.g., `getName()` instead of `name`).
Set config option `pathToWorker: 'lib/threadedclass-worker.js'`.
Use `import { threadedClass } from 'threadedclass'` or `const { threadedClass } = require('threadedclass')`.Ensure the path points to the .js file after compilation (e.g., ./professor.js). Compile TypeScript first.
Use the second argument as a string: `threadedClass('./professor.js', 'Professor', ...)`. In browser, you must pass the class reference.No dependency data recorded yet.