My project stopped working after the latest update. After some digging I discovered it's because webworker mode is enabled by default. With webworker on I can no longer access the document object in javascript. I used the document object to add third party .js to the page on startup for use by the rest of the project. My current workaround is to turn worker mode off.
Does anyone have any ideas how I could achieve this with worker mode on?
Is there a way to run one script on the main thread and the rest on a worker?
Is there a whole different way to do what I'm trying to do?
Any tips are appreciated.
Example Code: (Only works if ran on the main thread and not a worker)
function exampleFunction(){
var script1 = document.createElement('script');
script1.src = "https://www.3rdparty.com/api/1.0.0/code.js";
document.getElementsByTagName('body')[0].appendChild(script1);
script1.onload = function(){exampleFunction2()};
}