Added module and threading support for the inline version.

This commit is contained in:
n1474335 2017-08-25 00:25:49 +01:00
parent a61cf6a68a
commit a4aee761c2
5 changed files with 100 additions and 20 deletions

View file

@ -46,6 +46,11 @@ self.addEventListener("message", function(e) {
case "silentBake":
silentBake(e.data.data);
break;
case "docURL":
// Used to set the URL of the current document so that scripts can be
// imported into an inline worker.
self.docURL = e.data.data;
break;
default:
break;
}
@ -107,7 +112,7 @@ function loadRequiredModules(recipeConfig) {
if (!OpModules.hasOwnProperty(module)) {
console.log("Loading module " + module);
self.importScripts(module + ".js");
self.importScripts(self.docURL + "/" + module + ".js");
}
});
}