Is it possible to run ora
on Worker?
Currently, it freezed:
Open this stackblitz example code
Then in the stackblitz terminal run node index.js
.
Now you can see that working
is work as expected (because it's on the main thread), but loading
is not because it on the worker thread.
index.js:
// run `node index.js` in the terminal
const { Worker } = require('node:worker_threads');
const path = require('path');
const ora = require('ora');
console.log(`Hello Node.js v${process.versions.node}!`);
new Worker(path.resolve(__dirname, './worker.js'));
ora('working...').start();
setTimeout(() => {}, 10 * 1000); //<-- prevent node to exit.
worker.js:
const ora = require('ora');
ora('loading...').start();
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too