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










边栏推荐
- Unity SKFramework框架(十四)、Extension 扩展函数
- 解答:EasyDSS视频点播时音频是否可以设置为默认开启?
- 2、 Frame mode MPLS operation
- Record idea shortcut keys
- Unity skframework framework (XXI), texture filter map resource filtering tool
- Unity SKFramework框架(十三)、Question 问题模块
- (6) Web security | penetration test | network security encryption and decryption ciphertext related features, with super encryption and decryption software
- [youcans' image processing learning course] general contents
- Daily practice of C language --- monkeys divide peaches
- Pocket Raider comments
猜你喜欢

A better database client management tool than Navicat

OpenAPI generator: simplify the restful API development process

【蓝桥杯选拔赛真题43】Scratch航天飞行 少儿编程scratch蓝桥杯选拔赛真题讲解
![Student course selection information management system based on ssm+jsp framework [source code + database]](/img/71/900d83dba41974589b15d23e632119.png)
Student course selection information management system based on ssm+jsp framework [source code + database]

de4000h存储安装配置

无向图的桥

OpenFOAM:lduMatrix&lduAddressing

伙伴云表格强势升级!Pro版,更非凡!

leetcode621. 任务调度器

不会看器件手册的工程师不是个好厨子
随机推荐
Bridge of undirected graph
Word efficiency guide - word's own template
[indomitable medal activity] life goes on and writing goes on
De4000h storage installation configuration
(POJ - 1984) navigation nightare (weighted and search set)
Security RememberMe原理分析
Unity skframework framework (XVII), freecameracontroller God view / free view camera control script
Operation tutorial: how does easydss convert MP4 on demand files into RTSP video streams?
Find love for speed in F1 delta time Grand Prix
【笔耕不辍勋章活动】生命不止,写作不息
验证失败,请检查您的回电网址。您可以按照指导进行操作
Android kotlin fragment technology point
互联网常见34个术语解释
Unity SKFramework框架(十五)、Singleton 单例
Performance optimization of memory function
【OpenGL】笔记二十九、高级光照(镜面高光)
Web Foundation
二、帧模式 MPLS 操作
P3807 [template] Lucas theorem /lucas theorem
机器学习基础(二)——训练集和测试集的划分