Skip to content

Can you tell when share() completes/unsubscribes? #6253

Answered by cartant
raymonddavis asked this question in Q&A
Discussion options

You must be logged in to vote

You can use the finalize operator to run a function when the source completes, errors or is explicitly unsubscribed:

const shared = source.pipe(
   finalize(() => { /* whatever */ }),
   share()
);

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by raymonddavis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants