Commit | Line | Data |
---|---|---|
106744f7 | 1 | 'use strict' |
60fbd6d6 | 2 | const { ThreadWorker } = require('poolifier') |
106744f7 | 3 | |
4 | function yourFunction (data) { | |
5c5a1fb7 | 5 | if (data.functionName === 'fn0') { |
106744f7 | 6 | console.log('Executing function 0') |
7 | return { data: '0 your input was' + data.input } | |
5c5a1fb7 | 8 | } else if (data.functionName === 'fn1') { |
106744f7 | 9 | console.log('Executing function 1') |
10 | return { data: '1 your input was' + data.input } | |
11 | } | |
12 | } | |
13 | ||
1f9a5a44 | 14 | module.exports = new ThreadWorker(yourFunction) |