Skip to content

Instantly share code, notes, and snippets.

@petersirka
Last active March 22, 2016 21:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save petersirka/16e794f752bc3764f9fb to your computer and use it in GitHub Desktop.
Save petersirka/16e794f752bc3764f9fb to your computer and use it in GitHub Desktop.
function doWorker(arr, callback) {
var responses = {};
arr.wait(function(name, next) {
var worker = F.worker(name, name);
worker.on('message', function(obj) {
// Save the message
responses[name] = obj;
// We have a result, continue ...
if (obj) {
next();
return;
}
// Error?
if (callback) {
next = null;
callback(new Error('SHIT'), responses);
return;
}
});
}, function() {
callback(null, responses);
});
}
doWorker(['remove_photo_sets', '3d_sk', 'enviroment_textures', 'female_anatomy', 'human_anatomy', 'photo_reference', 'scans'], function(err, response) {
console.log(err, response);
console.log('done');
});
@tomee03
Copy link

tomee03 commented Mar 10, 2016

funguje to :) este raz dik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment