RxJS - 实用操作符 timestamp
返回 source 可观测对象发出的值以及时间戳,指示该值发出时的时刻。
语法
timestamp(): Observable
返回值
返回 source 可观测对象发出的值以及时间戳,指示该值发出时的时刻。
示例
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));
输出
广告