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



边栏推荐
- AOSP ~ NTP ( 网络时间协议 )
- Kubernetes 三打探针及探针方式
- Event preview | the live broadcast industry "rolled in" to drive new data growth points with product power
- Go language to realize static server
- Go语言实现静态服务器
- Ripper of vulnhub
- 在CoreOS下部署WordPress实例教程
- 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
- Repo ~ common commands
- Cadence background color setting
猜你喜欢

(database authorization - redis) summary of unauthorized access vulnerabilities in redis

Xml的(DTD,xml解析,xml建模)

STL教程10-容器共性和使用场景

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

Kibana~Kibana的安装和配置
![抓包整理外篇fiddler———— 会话栏与过滤器[二]](/img/04/e9cc027d753e7049f273d866eefdce.png)
抓包整理外篇fiddler———— 会话栏与过滤器[二]

Machine learning 3.2 decision tree model learning notes (to be supplemented)

Groovy test class and JUnit test

Spl06-007 air pressure sensor (example of barometer)

Based on MCU, how to realize OTA differential upgrade with zero code and no development?
随机推荐
This article explains the complex relationship between MCU, arm, MCU, DSP, FPGA and embedded system
PHP Basics
VS2015的下载地址和安装教程
Duplicate numbers in the array of sword finger offer 03
Dynamic programming (interval DP)
How to make others fear you
PHP server interacts with redis with a large number of close_ Wait analysis
Test classification in openstack
vulnhub之pyexp
Some common terms
Yintai department store ignites the city's "night economy"
vulnhub之presidential
Cacti监控Redis实现过程
Using onvif protocol to operate the device
Web安全总结
Ripper of vulnhub
鸿蒙第四次培训
Notes on 32-96 questions of sword finger offer
MySQL union和union all区别
DS90UB949