X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=yourWorker.js;h=c3a7b0c4a9d606abee2c8b9780e0fa6df0af59e4;hb=2899629e79cdce584d3c46d6021798eeb85dad9e;hp=ffb72c2969a0e6845801efa003b3e8c2dfc4fbce;hpb=27006a3d7cb579b1cddd70e32ebaaab1efff9555;p=poolifier.git diff --git a/yourWorker.js b/yourWorker.js index ffb72c29..c3a7b0c4 100644 --- a/yourWorker.js +++ b/yourWorker.js @@ -1,13 +1,17 @@ 'use strict' -const ThreadWorker = require('./worker') -const { isMainThread } = require('worker_threads') +const { ThreadWorker } = require('./lib/workers') class MyWorker extends ThreadWorker { constructor () { super((data) => { + for (let i = 0; i <= 10000; i++) { + const o = { + a: i + } + JSON.stringify(o) + } // console.log('This is the main thread ' + isMainThread) - // this.parent.postMessage(JSON.stringify(data)) - return JSON.stringify(data) + return data }) } }