Merge pull request #1 from pioardi/dependabot/npm_and_yarn/expect-25.1.0
[poolifier.git] / examples / yourWorker.js
CommitLineData
27006a3d 1'use strict'
c68d4281 2const { ThreadWorker } = require('../lib/workers')
27006a3d 3
106744f7 4function yourFunction (data) {
5 for (let i = 0; i <= 1000; i++) {
6 const o = {
7 a: i
8 }
9 JSON.stringify(o)
10 }
11 // console.log('This is the main thread ' + isMainThread)
12 return { ok: 1 }
13}
14
50811da2 15class MyWorker extends ThreadWorker {
27006a3d 16 constructor () {
106744f7 17 super(yourFunction)
27006a3d 18 }
19}
27006a3d 20module.exports = new MyWorker()