Ah, yes, it is similar to Vue's computed! It was one of the inspirations for this lib and we had a hope it would look familiar to Vue devs!
And with Observable streams you get additional features. For example, if a value is not produced synchronously — autorun would halt execution until it does. Exploiting this feature we can track never emitting stream to get a filtering behavior:
consta=timer(0,1_000);constc=computed(()=>$(a)%2?$(NEVER):$(a)+" - even");// > 0 - even > 2 - even > …
Not to mention that you can pipe the resulting stream with the many Rx operators. And I wouldn't even start describing late subscription / early unsubscription flows — the subject is too big for a comment 🙂
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Ah, yes, it is similar to Vue's computed! It was one of the inspirations for this lib and we had a hope it would look familiar to Vue devs!
And with Observable streams you get additional features. For example, if a value is not produced synchronously —
autorun
would halt execution until it does. Exploiting this feature we can track never emitting stream to get a filtering behavior:NOTE: it's not
undefined
at 1, it's skipped!↑ try this @ stackblitz.com/edit/rxjs-autorun-f...
Not to mention that you can
pipe
the resulting stream with the many Rx operators. And I wouldn't even start describing late subscription / early unsubscription flows — the subject is too big for a comment 🙂