X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=examples%2FmultifunctionWorker.js;h=61369cfa57171d2cc26c5028cd170e4cd51cf9c7;hb=14916bf9ec9e7e60b1c03e9b6d876fc23990afad;hp=87edd57d05585ca8da37d9a14e15a2a6472e4cc5;hpb=a3c8691eb5bd772a43746fd5860d54a786463039;p=poolifier.git diff --git a/examples/multifunctionWorker.js b/examples/multifunctionWorker.js index 87edd57d..61369cfa 100644 --- a/examples/multifunctionWorker.js +++ b/examples/multifunctionWorker.js @@ -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)