当前位置:网站首页>rxjs Observable filter Operator 的实现原理介绍
rxjs Observable filter Operator 的实现原理介绍
2022-07-03 11:01: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>;



边栏推荐
- How to become a senior digital IC Design Engineer (1-5) Verilog coding syntax: operand
- R language uses grid of gridextra package The array function combines multiple visual images of the lattice package horizontally, and the ncol parameter defines the number of columns of the combined g
- MATLAB提取不規則txt文件中的數值數據(簡單且實用)
- PHP基础
- 程序员的创业陷阱:接私活
- [vtk] interpretation of source code comments of vtkwindowedsincpolydatafilter
- CSRF
- Google Earth engine (GEE) -- when we use the front and back images to make up for the interpolation effect, what if there is no effect?
- VPP three-layer network interconnection configuration
- [OBS] configFile in ini format of OBS
猜你喜欢

ASP.NET-酒店管理系统

After watching the video, AI model learned to play my world: cutting trees, making boxes, making stone picks, everything is good

Solve undefined reference to`__ aeabi_ Uidivmod 'and undefined reference to`__ aeabi_ Uidiv 'error

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

The excel table is transferred to word, and the table does not exceed the edge paper range

Spl06-007 air pressure sensor (example of barometer)

GCC compilation process and dynamic link library and static link library

鸿蒙第四次培训

FL Studio 20无限试用版水果编曲下载

Hongmeng fourth training
随机推荐
Some common terms
R语言使用data.table包进行数据聚合统计计算滑动窗口统计值(Window Statistics)、计算滑动分组中位数(median)并合并生成的统计数据到原数据集中
Spl06-007 air pressure sensor (example of barometer)
PHP server interacts with redis with a large number of close_ Wait analysis
[VTK] vtkWindowedSincPolyDataFilter 源码注释解读
软考中级软件设计师该怎么备考
Stm32hal library upgrades firmware based on flash analog U disk (detailed explanation)
R language uses grid of gridextra package The array function combines multiple visual images of the ggplot2 package horizontally, and the ncol parameter defines the number of columns of the combined g
00后抛弃互联网: 毕业不想进大厂,要去搞最潮Web3
Kubernetes 三打探针及探针方式
repo ~ 常用命令
Software testing weekly (issue 78): the more confident you are about the future, the more patient you are about the present.
Uniapp implementation Click to load more
AI模型看看视频,就学会了玩《我的世界》:砍树、造箱子、制作石镐样样不差...
(2) Base
Modular programming of single chip microcomputer
如何将数字字符串转换为整数
Slam mapping and autonomous navigation simulation based on turnlebot3
导师对帮助研究生顺利完成学业提出了20条劝告:第一,不要有度假休息的打算.....
C language log base zlog basic use