Added status message mechanism for the Worker to report to the app

This commit is contained in:
n1474335 2017-08-25 01:24:12 +01:00
parent 6af82680f1
commit d68523a54e
6 changed files with 73 additions and 23 deletions

View file

@ -112,7 +112,21 @@ function loadRequiredModules(recipeConfig) {
if (!OpModules.hasOwnProperty(module)) {
console.log("Loading module " + module);
sendStatusMessage("Loading module " + module);
self.importScripts(self.docURL + "/" + module + ".js");
}
});
}
/**
* Send status update to the app.
*
* @param {string} msg
*/
function sendStatusMessage(msg) {
self.postMessage({
action: "statusMessage",
data: msg
});
}