Post

Svelte folks: Classes with DOM + cleanup, do you: A) Use $effect inside class methods (encapsulated, cleanup via returned disposal function) B) Keep class dumb, handle lifecycle in component `$effect` (tied to component lifecycle) I like A's clean API but B is more explicit. What's the move here?

0 reposts2 likes

let me give you some more context: i'm streaming events from several clients to a ws server, the stream should start as soon as the page loads/permissions are granted. The clients only track connection/error states, no other data returned from the server