Running in WebWorker
See original GitHub issueI see that the demo page runs in a worker thread but this code isn’t included in the Node distribution and from what I can see from the demo page, it is quite complicated. I can’t get the normal version loading because of
Uncaught (in promise) TypeError: Module scripts are not supported on WorkerGlobalScope yet (see https://crbug.com/680046).
at loadWasmModule (argon2.js:74)
at argon2.js:63
Are you planning to include proper worker support & code in the distribution as well? Otherwise, is there any simple way to get it working?
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Using Web Workers - Web APIs - MDN Web Docs
Web Workers are a simple means for web content to run scripts in background threads. The worker thread can perform tasks without interfering ......
Read more >Running fetch in a web worker - Medium
A Web Worker is a simple means for web content to run scripts in background threads. Think of it as a background process...
Read more >Managing Long-Running Tasks In A React App With Web ...
In this tutorial, we're going to learn how to use the Web Worker API to manage time-consuming and UI-blocking tasks in a JavaScript...
Read more >Reliably detect if the script is executing in a web worker
Any standard mechanism for detecting if a JavaScript is executing as a WebWorker? ... Can a JavaScript function check if its being run...
Read more >HTML Web Workers API - W3Schools
A web worker is a JavaScript that runs in the background, independently of other scripts, without affecting the performance of the page.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I built a wrapper module so you can easily use this module as a webworker in a webpack (or other project). Argon2-browser is loaded inline (no import scripts which don’t get SRI!!), so you can easily use it in any project.
yarn add argon2-webworker
https://github.com/etesync/argon2-webworkerI haven’t implemented all of the API, but the API is identical to this module, so using it is exactly the same.
In my case, I had the luxury of having webpack available which makes it super simple to run this in a webworker, in what I consider to be a very maintanable way.
npm i --save-dev worker-loader
.src
just as you would any other js, no need to worry about importscripts… don’t even have to change your webpack config, can just do an inlined import of your worker.