razshare / sveltekit-sse

Server Sent Events with SvelteKit
https://www.npmjs.com/package/sveltekit-sse
MIT License
301 stars 9 forks source link

chore(source): remove `StreamState` #38

Closed oscarhermoso closed 6 months ago

oscarhermoso commented 6 months ago

Removed StreamState type and readyState property from stream.js as it was unused.

I first noticed that readyState = OPEN was not reached unless there is a reconnect.

https://github.com/tncrazvan/sveltekit-sse/blob/eb99d00f2611ca00dd034df5530cdc906bad48f8/src/lib/stream.js#L189

This is because await fetchEventSource does not resolve until onclose/onerror fires. I then realised that the readyState value isn't actually read anywhere, and isn't exposed to the front-end either, so made sense to raise a PR to clean it up.

razshare commented 6 months ago

Looks good to me. In the future we should probably expose it properly, maybe even as a readable, it could be useful for debugging purposes. I'll merge this and release a patch.

razshare commented 6 months ago

Patch 0.9.4 is out!