当前位置:网站首页>Development skills of rxjs observable custom operator
Development skills of rxjs observable custom operator
2022-07-02 13:46: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
);










边栏推荐
- What are eNB, EPC and PGW?
- Nohup command
- Qt如何设置固定大小
- 验证失败,请检查您的回电网址。您可以按照指导进行操作
- Which do you choose between Alibaba P7 with an annual salary of 900000 and deputy department level cadres?
- P3008 [USACO11JAN]Roads and Planes G (SPFA + SLF优化)
- [技术发展-22]:网络与通信技术的应用与发展快速概览-2- 通信技术
- Android kotlin material design technology points
- Why can't d link DLL
- Dingtalk 发送消息
猜你喜欢

qt中uic的使用

De4000h storage installation configuration

Engineers who can't read device manuals are not good cooks

Unity skframework framework (XII), score scoring module

I did it with two lines of code. As a result, my sister had a more ingenious way

Independent and controllable 3D cloud CAD: crowncad enables innovative design of enterprises

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

Web基础
[document tree, setting] font becomes smaller

Japan bet on national luck: Web3.0, anyway, is not the first time to fail!
随机推荐
linux下清理系统缓存并释放内存
qt中uic的使用
leetcode621. task scheduler
2022 Heilongjiang provincial examination on the writing skills of Application Essays
【模板】最长公共子序列 (【DP or 贪心】板子)
D how to check null
浏览器驱动的下载
[document tree, setting] font becomes smaller
selenium,元素操作以及浏览器操作方法
How to explain binary search to my sister? This is really difficult, fan!
口袋奇兵点评
Web Foundation
JS reverse row query data decryption
Pattern matching and regular expressions in PostgreSQL - Das
TVOC, VOC, VOCs gas detection + Solution
Why is the default of switch followed by break?
P1347 sorting (topology + SPFA judgment ring or topology [inner judgment ring])
uniapp小程序 subPackages分包配置
代码实现MNLM
Pocket Raider comments