repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
chore: update changelog entries
[poolifier.git]
/
examples
/
multifunctionWorker.js
diff --git
a/examples/multifunctionWorker.js
b/examples/multifunctionWorker.js
index 87edd57d05585ca8da37d9a14e15a2a6472e4cc5..61369cfa57171d2cc26c5028cd170e4cd51cf9c7 100644
(file)
--- a/
examples/multifunctionWorker.js
+++ b/
examples/multifunctionWorker.js
@@
-1,19
+1,14
@@
'use strict'
'use strict'
-const { ThreadWorker } = require('
../lib/workers
')
+const { ThreadWorker } = require('
poolifier
')
function yourFunction (data) {
function yourFunction (data) {
- if (data.f
n
ame === 'fn0') {
+ if (data.f
unctionN
ame === 'fn0') {
console.log('Executing function 0')
return { data: '0 your input was' + data.input }
console.log('Executing function 0')
return { data: '0 your input was' + data.input }
- } else if (data.f
n
ame === 'fn1') {
+ } else if (data.f
unctionN
ame === 'fn1') {
console.log('Executing function 1')
return { data: '1 your input was' + data.input }
}
}
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)