-
-
Save Zodiase/3c8b9d9862ec3ac9c486ec75b99f341a to your computer and use it in GitHub Desktop.
Testing Hamsters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Using hamsters.js@4.1.2 | |
var hamsters = require('hamsters.js'); | |
var startOptions = { | |
maxThreads: 3, | |
persistence: false, | |
Worker: require("webworker-threads").Worker, | |
}; | |
hamsters.init(startOptions); | |
(function() { | |
var params = {'array':[0,1,2,3,4,5,6,7,8,9]}; | |
hamsters.run(params, function() { | |
console.log('params.array', params.array, params.array.length); | |
var arr = params.array; | |
arr.forEach(function(item) { | |
console.log('run'); | |
rtn.data.push((item * 120)/10); | |
}); | |
}, function(output) { | |
console.log(output); | |
return output; | |
}); | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "test-hamsters", | |
"version": "1.0.0", | |
"description": "", | |
"main": "main.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"hamsters.js": "^4.1.2", | |
"webworker-threads": "^0.7.11" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment