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



边栏推荐
- 多维度监控:智能监控的数据基础
- C language two-dimensional array
- Arctangent entropy: the latest SCI paper in July 2022
- Linear table sequence table comprehensive application problem p18
- Double linked list of linear list
- Xml的(DTD,xml解析,xml建模)
- Matlab extracts numerical data from irregular txt files (simple and practical)
- ASP.NET-酒店管理系統
- R language uses the aggregate function to calculate the mean value (sum) of dataframe data grouping aggregation without setting na The result of RM calculation. If the group contains the missing value
- Uniapp implementation Click to load more
猜你喜欢
FL Studio 20 unlimited trial fruit arranger Download
Web安全总结
Web security summary
Machine learning 3.2 decision tree model learning notes (to be supplemented)
After watching the video, AI model learned to play my world: cutting trees, making boxes, making stone picks, everything is good
C language AES encryption and decryption
Qt+VTK+OCCT读取IGES/STEP模型
Xml的(DTD,xml解析,xml建模)
Solve undefined reference to`__ aeabi_ Uidivmod 'and undefined reference to`__ aeabi_ Uidiv 'error
00后抛弃互联网: 毕业不想进大厂,要去搞最潮Web3
随机推荐
The excel table is transferred to word, and the table does not exceed the edge paper range
PHP基础
AI模型看看视频,就学会了玩《我的世界》:砍树、造箱子、制作石镐样样不差...
(数据库提权——Redis)Redis未授权访问漏洞总结
How to: configure ClickOnce trust prompt behavior
Intel 13th generation core flagship exposure, single core 5.5ghz
解决msvcp120d.dll和msvcr120d.dll缺失
How to become a senior digital IC Design Engineer (1-5) Verilog coding syntax: operand
Encapsulate a koa distributed locking middleware to solve the problem of idempotent or repeated requests
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?
机器学习 3.2 决策树模型 学习笔记(待补)
动态规划(区间dp)
Numpy np. Max and np Maximum implements the relu function
R语言使用aggregate函数计算dataframe数据分组聚合的均值(sum)、不设置na.rm计算的结果、如果分组中包含缺失值NA则计算结果也为NA
Stm32hal library upgrades firmware based on flash analog U disk (detailed explanation)
多维度监控:智能监控的数据基础
Mysql根据时间搜索常用方法整理
Numpy np.max和np.maximum实现relu函数
[VTK] vtkPolydataToImageStencil 源码解读
Solve undefined reference to`__ aeabi_ Uidivmod 'and undefined reference to`__ aeabi_ Uidiv 'error