I’ve started creating web workers using the API, and I just can’t get them to work.
Here’s my sample code:
var myAsyncProcess = new TaskProcessor('asyncProcess', Number.POSITIVE_INFINITY);
var promise = myAsyncProcess.scheduleTask([{
dataSource: dataSource
}]);
when(promise, function(result){
debugger;
});
I have a file: asyncProcess.js in the workers directory which is also added in the build/combine process (I can see it in the build/CesiumUnminified/workers folder after the build, with all the added goodies the build/combine process adds to the file):
/global define/
define([
‘…/DataSources/CustomDataSource’,
‘./createTaskProcessorWorker’
], function(
CustomDataSource,
createTaskProcessorWorker) {
“use strict”;
function asyncProcess(packedParameters, transferableObjects) {
debugger;
return 1;
}
debugger;
return createTaskProcessorWorker(asyncProcess);
});
When debugging, I’ve seen the postMessage being called in the “scheduleTask” method, and it entered the asyncProcess.js file. It went over the “define” lines, but never got to the “debugger” lines (hence, probably never creating the processor worker…).
Any idea what might be the issue? Am I missing anything?
Thanks