Skip to content

Instantly share code, notes, and snippets.

Last active Jan 20, 2021
What would you like to do?
workerRequire example
const { somethingCPUIntensive } = require('./cpu-intensive');
somethingCPUIntensive(); // run synchronously blocking the main thread
const { somethingCPUIntensive } = workerRequire('./cpu-intensive');
await somethingCPUIntensive(); // run asynchronously in a worker thread
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment