Skip to content

Instantly share code, notes, and snippets.

@corbanbrook
Created November 16, 2009 15:04
Show Gist options
  • Save corbanbrook/236044 to your computer and use it in GitHub Desktop.
Save corbanbrook/236044 to your computer and use it in GitHub Desktop.
var path = "";
var activeSubworkers = 0;
if ( typeof(options.workerpath) == 'string' || options.workerpath instanceof String ) {
path = options.workerpath;
}
var worker = new Worker(path + "metaworker.js");
worker.onmessage = function(event) {
var callbackData = event.data;
if ( callbackData.type=='data' ) {
options.callback(callbackData.payload);
} else if ( ({'log':true,'debug':true,'dir':true}).hasOwnProperty(callbackData.type) ) {
console[callbackData.type].apply(this,callbackData.payload);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment