chore: v2.4.10
[poolifier.git] / examples / multifunctionWorker.js
index 87edd57d05585ca8da37d9a14e15a2a6472e4cc5..61369cfa57171d2cc26c5028cd170e4cd51cf9c7 100644 (file)
@@ -1,19 +1,14 @@
 'use strict'
-const { ThreadWorker } = require('../lib/workers')
+const { ThreadWorker } = require('poolifier')
 
 function yourFunction (data) {
-  if (data.fname === 'fn0') {
+  if (data.functionName === 'fn0') {
     console.log('Executing function 0')
     return { data: '0 your input was' + data.input }
-  } else if (data.fname === 'fn1') {
+  } else if (data.functionName === 'fn1') {
     console.log('Executing function 1')
     return { data: '1 your input was' + data.input }
   }
 }
 
-class MyWorker extends ThreadWorker {
-  constructor () {
-    super(yourFunction)
-  }
-}
-module.exports = new MyWorker()
+module.exports = new ThreadWorker(yourFunction)