Sharing a Stream Across Multiple Svelte Components Using Effect and Scope

Hiya! I am using Effect and Svelte. I want to share (broadcast) a Stream of data with multiple Svelte components consuming the same data.

Since broadcast returns an Effect with Stream inside, and Svelte components are run outside of my control, I need to unwrap it at both sites separately before I can use the Stream. I'm guessing that using unwrapScoped at both sites won't be helpful, because I'd get two different Streams each broadcasting to one consumer? I'd like to use the same Scope for both unwraps I guess? But how would I go about creating a shared scope that I can use in both components? Because Scope.make() also returns the scope in an Effect, which needs to be unwrapped, seemingly moving the problem over. And if I do have a shared scope, how do I use it at both sites?
Was this page helpful?