The documentation for RxJS
defines AsyncSubject
as follows:
The AsyncSubject is a variant where only the last value of the Observable execution is sent to its observers, and only when the execution completes.
I don't see where / why I would ever need to use this variant of subject. Can someone provide an explanation or a real-world example to illustrate why it exists and its advantages?
It looks like it could be useful for fetching and caching (one-shot) resources, since generally http.get will emit one response then complete.
From rxjs/spec/subjects/AsyncSubject-spec.ts
Components that subscribe after the fetch will then pick up value, which is not the case for
Subject