Commit | Line | Data |
---|---|---|
27006a3d | 1 | 'use strict' |
2 | const ThreadWorker = require('./worker') | |
3 | const { isMainThread } = require('worker_threads') | |
4 | ||
5 | class 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 | ||
15 | module.exports = new MyWorker() |