Skip to content

Instantly share code, notes, and snippets.

@cartant
Last active February 13, 2019 20:27
Show Gist options
  • Save cartant/1b45497bbb560ea2d9552ce2d3e3421d to your computer and use it in GitHub Desktop.
Save cartant/1b45497bbb560ea2d9552ce2d3e3421d to your computer and use it in GitHub Desktop.
import { interval, timer } from "rxjs";
import { shareReplay, takeUntil } from "rxjs/operators";
import { log } from "./log";
const source = log(interval(100), "source");
const shared = log(source.pipe(shareReplay({
bufferSize: 1,
refCount: true
})), "shared");
shared.pipe(
takeUntil(timer(150))
).subscribe(
value => console.log(`received: ${value}`)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment