-
-
Notifications
You must be signed in to change notification settings - Fork 421
Understanding Signals vs Events
The most common analogy is comparing age
(signal) to birthday
(event)
As we know, in CycleJS Stream library like xstream / RxJS (depending on which release) is a peer dependency.
The confusing part is that streams can model both Signals and Events.. so the developer needs to know and make decision to convert the stream to either a Signal or an Event stream.
In Rx/xstream signal streams are represented as observables with replay/memory.
Event streams are represented as observables without memory.
If you have a stream that holds value over time ( state$? ), then most probably it's a Signal.. and it needs to be replay
-ed in Rx or remember
-ed in xstream to convert it to a memory stream.
From xstream 4.0.0 onwards, certain things like startWith
will turn a stream into a memory stream.