本文整理汇总了TypeScript中rxjs/internal/observable.Observable.pipe方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Observable.pipe方法的具体用法?TypeScript Observable.pipe怎么用?TypeScript Observable.pipe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rxjs/internal/observable.Observable
的用法示例。
在下文中一共展示了Observable.pipe方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: multiplyByTen
});
console.log('Before subscribe');
alias.subscribe(observer);
console.log('After subscribe');
/*** unicast vs multicast **/
const randomNumber = new Observable<number>(obs => {
obs.next(Math.random());
});
randomNumber.subscribe(value => console.log('1st subscription emits: ', value));
randomNumber.subscribe(value => console.log('2nd subscription emits: ', value));
const multicast = randomNumber.pipe(shareReplay());
multicast.subscribe(value => console.log('1st subscription emits: ', value));
multicast.subscribe(value => console.log('2nd subscription emits: ', value));
/*** hot vs cold observables **/
const infinite = RxJS.interval(1000).pipe(publish()) as ConnectableObservable<number>;
infinite.connect();
setTimeout(() => infinite.subscribe(v => console.log('1st subscriber:', v)), 2000);
setTimeout(() => infinite.subscribe(v => console.log('2nd subscriber: ', v)), 3000);
/*** Operators **/
function multiplyByTen(input: Observable<number>): Observable<number> {