mutiny-web
mutiny-web copied to clipboard
shared worker
closes #601 (kind of)
I've confused the concept of ServiceWorker and SharedWorker a lot of times. What we have here is a SharedWorker... in the future this will make it easier for a ServiceWorker to connect to the one canonical instance of Mutiny, whether or not the app is open.
For now, the main win is getting all the mutiny work off the main UI thread. Everything should be more responsive (no blocking) and in some cases faster (no contention, so faster, though there is a serialization cost going across threads).
TODO:
- [ ] add the doc strings
- [ ] test everything
Deploying mutiny-web with
Cloudflare Pages
| Latest commit: |
8f94770
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://6597b4b5.mutiny-web.pages.dev |
| Branch Preview URL: | https://sw.mutiny-web.pages.dev |
in some places you do sw.function() and others you do sw?.function() what is the reasoning there?
edit: I think I only actually saw one
What we have here is a SharedWorker.
this site says it doesn't work for chrome android :cry:, will need to test
probably should add to the screen where we detect if js/wasm is enabled, that shared workers are available
What we have here is a SharedWorker.
this site says it doesn't work for chrome android 😢, will need to test
probably should add to the screen where we detect if js/wasm is enabled, that shared workers are available
THIS IS SO SAD :(. It's a one line change to make it a non-shared worker, but I might look into detecting Chrome Android specifically so we can use sharedworker other places. But that means I need to bring back all the double init defense stuff :(
I'm also having trouble with capacitor right now. It's not working iOS or Android, for what might be different reasons. One problem is this import.meta.url which doesn't seem to exist in the Capacitor environment, trying to figure it out.
Got android working...
But iOS is mad about something. Works in desktop safari...
Everywhere where you do
// PAINin the worker is where we return a wasm_bindgen type instead of aJsValuethis was supposed to be nicer for you but seems like it is worse now. Maybe in mutiny-wasm we should just try to doJsValueeverywhere now
yeah it sucks because the JsValue erases the type so I have to go digging to figure out what it's actually returning. do you remember why this was rejected btw? https://github.com/MutinyWallet/mutiny-node/pull/882
Wasm bindgen does the same thing, it just doesn't work for async functions yet. I think they recently merged support for it though
My mainnet tests on my android phone are great. No more flicker. Page switches are much faster now. Signet will need a full end to end test but this is really smooth. Nice work!
I don't think it's intended to be at the bottom?