RxJS:过滤运算符distinct

与先前的值相比,此运算符将提供可观察到的来自源的所有值。

语法

distinct()

返回值

它返回一个具有不同值的observable。

import { of } from 'rxjs';
import { distinct } from 'rxjs/operators';

let all_nums = of(1, 6, 15, 1, 10, 6, 40, 10, 58, 20, 40);
let final_val = all_nums.pipe(distinct());
final_val.subscribe(x => console.log("The Distinct values are "+x));

输出

RxJS:过滤运算符distinct

作者:terry,如若转载,请注明出处:https://www.web176.com/rxjs/1865.html

(0)
打赏 支付宝 支付宝 微信 微信
terryterry
上一篇 2021年2月9日 上午11:24
下一篇 2021年2月9日 上午11:26

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注