当前位置:网站首页>rxjs Observable 自定义 Operator 的开发技巧
rxjs Observable 自定义 Operator 的开发技巧
2022-07-02 10:11:00 【InfoQ】
import { interval, of } from 'rxjs';
function fancyOperator(source) {
return source;
}
interval(1000)
.pipe(fancyOperator)
.subscribe((value) => console.log(value));



import { interval, Observable } from 'rxjs';
function fancyOperator(source) {
return Observable.create((observer) => {
observer.next('Jerry');
observer.complete();
});
}
interval(1000)
.pipe(fancyOperator)
.subscribe((value) => console.log(value));

import { fromEvent, interval, Observable } from 'rxjs';
import { filter } from 'rxjs/operators';
function filterKey(key) {
return filter((event: KeyboardEvent) => event.key === key);
}
fromEvent(document, 'keyup')
.pipe(filterKey('Enter'))
.subscribe(
(data) => console.log(data) // KeyboardEvent
);










边栏推荐
猜你喜欢

研究表明“气味相投”更易成为朋友

Memory management 01 - link script

无向图的桥

Unity SKFramework框架(十九)、POI 兴趣点/信息点

The second anniversary of the three winged bird: the wings are getting richer and the take-off is just around the corner

SAP MM 因物料有负库存导致MMPV开账期失败问题之对策

2、 Frame mode MPLS operation

Unity skframework framework (XVI), package manager development kit Manager

TVOC, VOC, VOCs gas detection + Solution

Three methods of finding LCA of the nearest common ancestor
随机推荐
Essential for operation and maintenance - Elk log analysis system
Winter vacation daily question - lucky numbers in the matrix
numpy数组计算
ADB basic commands
de4000h存储安装配置
Professor of Shanghai Jiaotong University: he Yuanjun - bounding box (containment / bounding box)
The second anniversary of the three winged bird: the wings are getting richer and the take-off is just around the corner
D如何检查null
I did it with two lines of code. As a result, my sister had a more ingenious way
[technology development-22]: rapid overview of the application and development of network and communication technology-2-communication Technology
Astro learning notes
Redis database persistence
What are the classifications of SSL certificates? How to choose the appropriate SSL certificate?
Unity skframework framework (XII), score scoring module
Verification failed, please check your call back website. You can follow the instructions
Unity SKFramework框架(二十)、VFX Lab 特效库
能自动更新的万能周报模板,有手就会用!
Web基础
三翼鸟两周年:羽翼渐丰,腾飞指日可待
Explanation: here is your UFO, Goldbach conjecture