scratch-gui icon indicating copy to clipboard operation
scratch-gui copied to clipboard

Default web worker URL to online version

Open SheepTester opened this issue 4 years ago • 4 comments

https://canary.discord.com/channels/@me/818068592708550696/849688330505682946

If the user's on a file:// URL or maybe if loading the local web worker fails, then try the online version

SheepTester avatar Jun 04 '21 16:06 SheepTester

This is a bit complicated because it's loading the Web Worker using some webpack plugin, so we don't have direct access to the URL

https://github.com/SheepTester/scratch-vm/blob/dd071464816ebb7a7b9f757c8d58edbad5b8f876/src/extension-support/extension-manager.js#L159-L165

SheepTester avatar Jun 30 '21 19:06 SheepTester

This might get even more complicated because the HTMLifier relies on parsing the bundled code to splice in worker code from a string

https://github.com/SheepTester/htmlifier/blob/55590b15b444d9e0c9d295439367a6da2268711e/hacky-file-getter.js#L222-L249

SheepTester avatar Jun 30 '21 19:06 SheepTester

image Well, that sucks

SheepTester avatar Jun 30 '21 19:06 SheepTester

Hmm, perhaps it could be loaded using the HTMLifier's way of URL.createObjectURL'ing the worker code, but this is just getting increasingly hacky

This currently prevents the offline version from using extensions I believe though, so I won't close this

SheepTester avatar Jun 30 '21 19:06 SheepTester