Web worker thread for performance boost #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🤔 Originally I wanted to use a web-worker to offload JS work from the main thread so that this widget would be non-intrusive & high performance. This can be useful because some companies may be hesitant to add an embed widget to their website if the main JS thread is busy. In theory, offloading work to a separate web-worker JS thread would give a performance boost as the main JS thread is barely touched by this widget.
However in practice 🤣 loading a web-worker from a cross-origin CDN is actually a XSS security vulnerability as explained by the W3C team here in w3c/ServiceWorker#940 (comment)
There are 2 possible workarounds, but they add extra complexity and might not be worth enough juice for the squeeze: