X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=examples%2FyourWorker.js;fp=examples%2FyourWorker.js;h=5036d5746be21fe1b48310b7909f0f6f0fb057b3;hb=c68d4281d92ef0da01fc89fb00a93d3a17ba392e;hp=0000000000000000000000000000000000000000;hpb=a63eb03c3a3ddaf0c2cc938458c7958352d02f94;p=poolifier.git diff --git a/examples/yourWorker.js b/examples/yourWorker.js new file mode 100644 index 00000000..5036d574 --- /dev/null +++ b/examples/yourWorker.js @@ -0,0 +1,19 @@ +'use strict' +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) + return { ok: 1 } + }) + } +} + +module.exports = new MyWorker()