Threads are supported on the web platform as a whole and are supposed to be supported on Love.js. However, the current demo pages and example code running locally on my device do not work at all.
Threads would be useful to get off-main-thread image decoding and image pre-loading working like they do in the native apps - reduces load times for battles/deck editor and eliminates lag when quickly switching pages.
https://github.com/FormularSumo/Star-Wars-Galaxy-Collection/issues/81
Summary of previous findings
I've switched to compiling in non-compatibility mode and included love.worker.js. I've yet to get the "Uncaught ReferenceError: SharedArrayBuffer is not defined" error, but to be thorough I also tried using a script (from this issue) to add the correct cross-origin headers, as Github pages doesn't support this, but without any effect. I've also done all my testing with the game and the Love wiki thread example. My testing has been in localhost anyway, which I think should support the headers, at least with the extension I've temporarily installed to always enable.
Also strange is the Love.js compatibility example does not work with threads despite saying it should, and the non-compatibility one won't run whatever I do (extension, firefox/chrome, whatever). So I think I'm going to have to conclude that threads are currently broken in Love.js and easiest thing is if I just rewrite it to be like it was previously, doing image decoding on the main thread :/
I should test on Github pages as well just to double check, and also check if non-compatibility mode works there on all browsers - if so would presumably be better than compatibility mode ("dodgy audio")
Initial test of non-compatibility mode: works fine in Firefox and Chrome, not Safari (who would have guessed). Testing now with cross-origin script
With cross-origin headers in theory set and worker.js it now runs on Safari, but audio is completely broken
Testing multi-threading version on Github pages, threads still don't do anything like in localhost on any browser. And audio is still broken on iOS. So unfortunately will have to go back to non-compatibility I think, and remove multithreading from web version.
For good measure have tried threads on non-compatibilty mode github pages, with love.worker installed, but still doesn't work.
Threads are supported on the web platform as a whole and are supposed to be supported on Love.js. However, the current demo pages and example code running locally on my device do not work at all.
Threads would be useful to get off-main-thread image decoding and image pre-loading working like they do in the native apps - reduces load times for battles/deck editor and eliminates lag when quickly switching pages. https://github.com/FormularSumo/Star-Wars-Galaxy-Collection/issues/81
Summary of previous findings
I've switched to compiling in non-compatibility mode and included love.worker.js. I've yet to get the "Uncaught ReferenceError: SharedArrayBuffer is not defined" error, but to be thorough I also tried using a script (from this issue) to add the correct cross-origin headers, as Github pages doesn't support this, but without any effect. I've also done all my testing with the game and the Love wiki thread example. My testing has been in localhost anyway, which I think should support the headers, at least with the extension I've temporarily installed to always enable.
Also strange is the Love.js compatibility example does not work with threads despite saying it should, and the non-compatibility one won't run whatever I do (extension, firefox/chrome, whatever). So I think I'm going to have to conclude that threads are currently broken in Love.js and easiest thing is if I just rewrite it to be like it was previously, doing image decoding on the main thread :/
I should test on Github pages as well just to double check, and also check if non-compatibility mode works there on all browsers - if so would presumably be better than compatibility mode ("dodgy audio")
Initial test of non-compatibility mode: works fine in Firefox and Chrome, not Safari (who would have guessed). Testing now with cross-origin script
With cross-origin headers in theory set and worker.js it now runs on Safari, but audio is completely broken
Testing multi-threading version on Github pages, threads still don't do anything like in localhost on any browser. And audio is still broken on iOS. So unfortunately will have to go back to non-compatibility I think, and remove multithreading from web version.
For good measure have tried threads on non-compatibilty mode github pages, with love.worker installed, but still doesn't work.