当前位置:网站首页>Introduction to the implementation principle of rxjs observable filter operator
Introduction to the implementation principle of rxjs observable filter operator
2022-07-03 11:50:00 【InfoQ】
import { fromEvent, interval, MonoTypeOperatorFunction } from 'rxjs';
import { filter } from 'rxjs/operators';
function filterKey(key) {
console.log('input: ', key);
const result: MonoTypeOperatorFunction<KeyboardEvent> = filter(
(event: KeyboardEvent) => {
console.log('input event: ', event);
return event.key === key;
}
);
console.log('result: ', result);
return result;
}
fromEvent(document, 'keyup')
.pipe(filterKey('Enter'))
.subscribe(
(data) => console.log(data) // KeyboardEvent
);












setupSubscription
export declare function filter<T>(predicate: (value: T, index: number) => boolean, thisArg?: any): MonoTypeOperatorFunction<T>;



边栏推荐
- 机器学习 3.2 决策树模型 学习笔记(待补)
- This article explains the complex relationship between MCU, arm, MCU, DSP, FPGA and embedded system
- 鸿蒙第四次培训
- MySQL uses the method of updating linked tables with update
- vulnhub之momentum
- OpenStack中的测试分类
- Spl06-007 air pressure sensor (example of barometer)
- 小鹏 P7 撞护栏安全气囊未弹出,官方回应称撞击力度未达到弹出要求
- uniapp实现点击加载更多
- previous permutation lintcode51
猜你喜欢

Redis things

Numpy np.max和np.maximum实现relu函数

鸿蒙第三次培训(项目实训)

小鹏 P7 撞护栏安全气囊未弹出,官方回应称撞击力度未达到弹出要求

STL tutorial 10 container commonalities and usage scenarios

Understand go language context in one article

Event preview | the live broadcast industry "rolled in" to drive new data growth points with product power

牛牛的组队竞赛

After using the thread pool for so long, do you really know how to reasonably configure the number of threads?

错排问题 (抽奖,发邮件)
随机推荐
Dynamic programming (interval DP)
Sheet1$. Output [excel source output] Error in column [xxx]. The returned column status is: "the text is truncated, or one or more characters have no matches in the target code page.".
vulnhub之narak
Stm32hal library upgrades firmware based on flash analog U disk (detailed explanation)
Xml的(DTD,xml解析,xml建模)
rxjs Observable filter Operator 的实现原理介绍
鸿蒙第四次培训
previous permutation lintcode51
Raven2 of vulnhub
Nestjs配置服务,配置Cookie和Session
How to get started embedded future development direction of embedded
R language uses data The table package performs data aggregation statistics, calculates window statistics, calculates the median of sliding groups, and merges the generated statistical data into the o
Yintai department store ignites the city's "night economy"
The tutor put forward 20 pieces of advice to help graduate students successfully complete their studies: first, don't plan to take a vacation
利用Zabbix动态监控磁盘I/O
PHP server interacts with redis with a large number of close_ Wait analysis
P3250 [HNOI2016] 网络 + [NECPC2022] F.Tree Path 树剖+线段树维护堆
vulnhub之presidential
(database authorization - redis) summary of unauthorized access vulnerabilities in redis
Asyncio warning deprecationwarning: there is no current event loop