Working implementation with a very good benchmark based on num of threads
[poolifier.git] / yourWorker.js
CommitLineData
27006a3d 1'use strict'
2const ThreadWorker = require('./worker')
3const { isMainThread } = require('worker_threads')
4
5class MyWorker extends ThreadWorker {
6 constructor () {
7 super((data) => {
8 // console.log('This is the main thread ' + isMainThread)
9 // this.parent.postMessage(JSON.stringify(data))
10 return JSON.stringify(data)
11 })
12 }
13}
14
15module.exports = new MyWorker()