Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save LayZeeDK/0a13bbe52b5a66b1f20bebb6a1328c83 to your computer and use it in GitHub Desktop.
Save LayZeeDK/0a13bbe52b5a66b1f20bebb6a1328c83 to your computer and use it in GitHub Desktop.
RxJS ≥6 version
const source = instrument(interval(100));
const counted = source.pipe(publish(), refCount());
const a = counted.subscribe(observer("a"));
setTimeout(() => a.unsubscribe(), 110);
setTimeout(() => counted.subscribe(observer("b")), 120);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment