I am trying to implement web workers in my application but for some reason functions like alert
and console error
with undefined.
My web worker code:
AJAX = new XMLHttpRequest();
AJAX.open("GET", 'Record/fetchEntity', true);
AJAX.send();
var result = AJAX.responseText;
console.log(result); // Errors with 'console is not defined'.
self.postMessage(result);
By the way, result
is an array of objects. Will this pass back ok to the master the way I have done it?