All quizzesHard
Higher-Order Observables — Series 2
Preview — 3 of 10 questions
What do these options control?
javascript
source$.pipe(share({
connector: () => new ReplaySubject(1),
resetOnRefCountZero: false,
resetOnError: true,
}))Aconnector chooses the subject that multicasts — a ReplaySubject(1) here, which makes this equivalent to shareReplay(1); the reset flags decide whether the shared subscription is torn down when subscribers leave or when the source errors
Bconnector is the HTTP connection to reuse
CThe options only affect debugging output
DresetOnRefCountZero: false means the source is resubscribed for every new subscriber
When does the observable emit relative to the signal write?
javascript
count = signal(0);
count$ = toObservable(this.count);ASynchronously, inside count.set()
BOnly when something subscribes, replaying every past value
CNever for the initial value
DAsynchronously: it is backed by an effect, so emissions are delivered when effects run, and several writes in the same tick can collapse into one emission of the final value
What does this change?
javascript
const a$ = of(Date.now());
const b$ = defer(() => of(Date.now()));ANothing; of is already lazy
Ba$ captures the timestamp once, when the observable is created; b$ runs its factory per subscription, so each subscriber gets the time at its subscription
Cb$ emits continuously
Db$ caches the first subscriber's value for all later ones
Sign up free to play
Answer all 10 questions (7 more), see explanations for every answer, and track your score.