当前位置:网站首页>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>;



边栏推荐
- Ripper of vulnhub
- How to get started embedded future development direction of embedded
- Capturing and sorting out external Fiddler -- Conversation bar and filter [2]
- The tutor put forward 20 pieces of advice to help graduate students successfully complete their studies: first, don't plan to take a vacation
- uniapp scroll view 解决高度自适应、弹框滚动穿透等问题。
- 外插散点数据
- 小鹏 P7 撞护栏安全气囊未弹出,官方回应称撞击力度未达到弹出要求
- phpcms 提示信息页面跳转showmessage
- R language ggplot2 visualization: gganimate package creates dynamic line graph animation (GIF) and uses transition_ The reveal function displays data step by step along a given dimension in the animat
- Asyncio warning deprecationwarning: there is no current event loop
猜你喜欢

聊聊Flink框架中的状态管理机制

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

Vulnhub geminiinc

Viewing binary bin files with notepad++ editor

ArcGIS应用(二十一)Arcmap删除图层指定要素的方法

vulnhub之presidential

Xiaopeng P7 hit the guardrail and the airbag did not pop up. The official responded that the impact strength did not meet the ejection requirements

2022 东北四省赛 VP记录/补题

C language AES encryption and decryption

Vulnhub narak
随机推荐
Event preview | the live broadcast industry "rolled in" to drive new data growth points with product power
Go language to realize static server
vulnhub之cereal
uniapp实现点击加载更多
Mmc5603nj geomagnetic sensor (Compass example)
Qt+VTK+OCCT读取IGES/STEP模型
836. 合并集合(DAY 63)并查集
基于turtlebot3实现SLAM建图及自主导航仿真
How to get started embedded future development direction of embedded
vulnhub之raven2
【学习笔记】dp 状态与转移
量化计算调研
MCDF实验1
phpcms 提示信息页面跳转showmessage
mysql使用update联表更新的方法
Yintai department store ignites the city's "night economy"
利用Zabbix动态监控磁盘I/O
Hongmeng fourth training
The R language uses the hist function in the native package (basic import package, graphics) to visualize the histogram plot
P3250 [hnoi2016] Network + [necpc2022] f.tree path tree section + segment tree maintenance heap