public/cornerstoneWADOImageLoaderWebWorker.js
/**
 * Initialization function that loads additional web workers and initializes them
 * @param data
 */
Initialization function that loads additional web workers and initializes them
@param data
Initialization function that loads additional web workers and initializes them @param data
function initialize(data) {
  if (initialized) {
    return;
  }
  config = data.config;
  if (data.config.webWorkerTaskPaths) {
    for (var i = 0; i < data.config.webWorkerTaskPaths.length; i++) {
      self.importScripts(data.config.webWorkerTaskPaths[i]);
    }
  }
  Object.keys(taskHandlers).forEach(function (key) {
    taskHandlers[key].initialize(config.taskConfiguration);
  });
  self.postMessage({
    taskType: 'initialize',
    status: 'success',
    result: {},
    workerIndex: data.workerIndex
  });
  initialized = true;
}
function initialize ( data ) { if ( initialized ) { return ; } config = data . config ; if ( data . config . webWorkerTaskPaths ) { for ( var i = 0 ; i < data . config . webWorkerTaskPaths . length ; i ++ ) { self . importScripts ( data . config . webWorkerTaskPaths [ i ] ) ; } } Object . keys ( taskHandlers ) . forEach ( function ( key ) { taskHandlers [ key ] . initialize ( config . taskConfiguration ) ; } ) ; self . postMessage ( { taskType : 'initialize' , status : 'success' , result : { } , workerIndex : data . workerIndex } ) ; initialized = true ; }
Initialization function that loads additional web workers and initializes them
 @param data
Initialization function that loads additional web workers and initializes them @param data
// console.log('web worker initialize ', data.workerIndex); // prevent initialization from happening more than once // save the config data // load any additional web worker tasks // initialize each task handler // tell main ui thread that we have completed initialization