-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
For example, if you have a web socket, and you get a close event, I'm proposing that we just complete it for the user. This of course means identifying different things that are like this and handling them appropriately.
const socket = new WebSocket('wss://whatever');
socket.when('close').subscribe({
next: () => console.log('closed'),
complete: () => console.log('done'),
});AbortSignal's abort is another one I can think of off the top of my head.
Alternatively, users will just have to add a take(1) to them.
But this does illustrate another advantage to Observable over addEventListener. It also causes the subscription to teardown and clean up, which can cascade through flatMap and other composition.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels