RxJS - 实用运算符时间戳

返回时间戳以及源 Observable 发出的值,该值告知发出值的时间。

语法

timestamp(): Observable

返回值

返回时间戳以及源 Observable 发出的值,该值告知发出值的时间。

示例

import { of } from 'rxjs';
import { filter, timestamp } from 'rxjs/operators';

let list1 = of(2, 3, 4, 5, 6);
let final_val = list1.pipe(timestamp());
final_val.subscribe(x => console.log(x));

输出

timestamp Operator