mirror of https://github.com/nodejs/node.git
doc: fix issue with worker_threads docs
This example function returns a promise directly rather than implicitly via async/await. PR-URL: https://github.com/nodejs/node/pull/25712 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>pull/25780/head
parent
46c5c3388d
commit
a0419dd8ca
|
@ -25,7 +25,7 @@ const {
|
|||
} = require('worker_threads');
|
||||
|
||||
if (isMainThread) {
|
||||
module.exports = async function parseJSAsync(script) {
|
||||
module.exports = function parseJSAsync(script) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const worker = new Worker(__filename, {
|
||||
workerData: script
|
||||
|
|
Loading…
Reference in New Issue