Skip to content

Instantly share code, notes, and snippets.

@dongyuwei
Created February 13, 2020 10:50
Show Gist options
  • Save dongyuwei/c1caea96df9165adab839a1379beafef to your computer and use it in GitHub Desktop.
Save dongyuwei/c1caea96df9165adab839a1379beafef to your computer and use it in GitHub Desktop.
import { range, merge, Subject } from 'rxjs';
import { take, takeLast, multicast } from 'rxjs/operators';
range(1, 10)
.pipe(
multicast(() => new Subject(), o => merge(
o.pipe(take(1)),
o.pipe(takeLast(1)),
)),
)
.subscribe(v => console.log('result', v));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment