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










边栏推荐
- Japan bet on national luck: Web3.0, anyway, is not the first time to fail!
- (6) Web security | penetration test | network security encryption and decryption ciphertext related features, with super encryption and decryption software
- 免费SSL证书知多少?免费SSL证书和收费SSL证书的区别
- JS逆向之行行查data解密
- Engineers who can't read device manuals are not good cooks
- MAC (MacOS Monterey 12.2 M1) personal use PHP development
- 运维必备——ELK日志分析系统
- Error function ERF
- 中文姓名提取(玩具代码——准头太小,权当玩闹)
- leetcode621. task scheduler
猜你喜欢
EasyDSS点播服务分享时间出错如何修改?
Embedded software development
Partner cloud form strong upgrade! Pro version, more extraordinary!
无向图的桥
[cloud native database] what to do when encountering slow SQL (Part 1)?
Solve "sub number integer", "jump happily", "turn on the light"
OpenAPI generator: simplify the restful API development process
(7) Web security | penetration testing | how does network security determine whether CND exists, and how to bypass CND to find the real IP
Unity SKFramework框架(十九)、POI 兴趣点/信息点
Unity skframework framework (XIII), question module
随机推荐
P3807 [template] Lucas theorem /lucas theorem
(6) Web security | penetration test | network security encryption and decryption ciphertext related features, with super encryption and decryption software
运维必备——ELK日志分析系统
linux下清理系统缓存并释放内存
Find love for speed in F1 delta time Grand Prix
Unity SKFramework框架(十二)、Score 计分模块
Error function ERF
D为何链接不了dll
Lucky numbers in the [leetcode daily question] matrix
numpy数组计算
Don't spend money, spend an hour to build your own blog website
Solution: Compression Technology (original version and sequel version)
【云原生数据库】遇到慢SQL该怎么办(上)?
【蓝桥杯选拔赛真题43】Scratch航天飞行 少儿编程scratch蓝桥杯选拔赛真题讲解
不会看器件手册的工程师不是个好厨子
基于ssm+jsp框架实现的学生选课信息管理系统【源码+数据库】
验证失败,请检查您的回电网址。您可以按照指导进行操作
Countermeasures for the failure of MMPV billing period caused by negative inventory of materials in SAP mm
Student course selection information management system based on ssm+jsp framework [source code + database]
Unity skframework framework (XX), VFX lab special effects library