You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hi there! i haven't had much time for this crate recently, and i don't personally have a need for shared workers. but as long as it follows the style of the current code i'd be happy to merge it if you'd like to build it yourself.
i suspect it could use the same WebWorker trait and maybe the same ChannelWorker implementation, but with a different mode of construction where it checks if it already exists or not, turning it from an scsc channel to an mpsc. the tricky part is how to handle responses, should they be copied to all tabs or just sent to one? maybe that should be configurable? not sure.EDIT: i looked at how SharedWorkers actually work in the browser, seems like they get this ports list of connection that it can use to send messages to one or all tabs, so it has to be a new kind of worker. the current workers are very request-response oriented, is that your usecase too or are you intending to have some sort of scheduled trigger in the worker? i feel like that's going to decide how the worker function should look.
if you're on leptos 0.6 you can start from the main branch, if you're on leptos 0.7 i'd start from the send-sync branch. let me know if you're starting from send-sync and i'll put some effort into merging that ASAP.
Motivations
Hi! I have been looking at this crate to implement a
SharedWorker
, I'm specifically looking for an approach that looks like this:But I don't seem to find references in docs nor code to SharedWorkers.
Yes
Solution
Provide a
SharedWorker
implementation similar toleptos_workers/leptos_workers/src/workers/web_worker.rs
Line 5 in ce73220
Alternatives
I think using
web-sys
is the safest approach but I could be missing something.Additional context
N/A
The text was updated successfully, but these errors were encountered: