Skip to content

Instantly share code, notes, and snippets.

@cartant
Last active May 13, 2019 02:06
Show Gist options
  • Save cartant/a3e5932220390befde081765b48cdffa to your computer and use it in GitHub Desktop.
Save cartant/a3e5932220390befde081765b48cdffa to your computer and use it in GitHub Desktop.
import { concat, of, race, timer } from "rxjs";
import { delay, mapTo, publish } from "rxjs/operators";
const source = of(42).pipe(delay(100));
const composed = source.pipe(
publish(published => race(
published,
concat(timer(10).pipe(mapTo(54)), published)
))
);
composed.subscribe(value => console.log(value));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment