当前位置:网站首页>Usage of rxjs mergemap
Usage of rxjs mergemap
2022-06-27 11:45:00 【InfoQ】
- flatMap yes mergeMap Another name for .
- If only one internal subscription can be activated at a time , Please use switchMap.
- If inside observables The order of launch and subscription is very important , Please use concatMap.
import { fromEvent, of } from 'rxjs';
import { mergeMap, delay } from 'rxjs/operators';
// faking network request for save
const saveLocation = location => {
return of(location).pipe(delay(500));
};
// streams
const click$ = fromEvent(document, 'click');
click$
.pipe(
mergeMap((e: MouseEvent) => {
return saveLocation({
x: e.clientX,
y: e.clientY,
timestamp: Date.now()
});
})
)
// Saved! {x: 98, y: 170, ...}
.subscribe(r => console.log('Saved!', r));




边栏推荐
- 飞桨产业级开源模型库:加速企业AI任务开发与应用
- [tcapulusdb knowledge base] Introduction to tcapulusdb data structure
- Popular science of device review: popular science of innovative medical device series - sternum plate products
- After Jerry's sleep, the regular wake-up system continues to run without resetting [chapter]
- 从零开始搭建物联网系统
- Leetcode 729. My schedule I (awesome, solved)
- Drive to APasS! Use Mingdao cloud to manage F1 events
- 杰理之串口通信 串口接收IO需要设置数字功能【篇】
- Oracle-分组统计查询
- 【TcaplusDB知识库】TcaplusDB数据构造介绍
猜你喜欢
![[worthy of collection] centos7 installation MySQL complete operation command](/img/23/7c4b69e1abc3a3ceba9b79cebe1c9b.png)
[worthy of collection] centos7 installation MySQL complete operation command

KDD 2022 | epileptic wave prediction based on hierarchical graph diffusion learning

Leetcode 729. My schedule I (awesome, solved)

Drive to APasS!使用明道云管理F1赛事

Redis 分布式锁15问,看看你都掌握了哪些?

“互联网+”大赛命题火热对接中 | 一图读懂百度38道命题

Unity shader learning (II) the first shader

Nvme2.0 protocol - new features

Wait, how do I use setmemorylimit?

Mqtt protocol stack principle and interaction flow chart
随机推荐
QStyle类用法总结(二)
istio相关资料
AutoCAD - three pruning methods
Codeforces Round #786 (Div. 3) ABCDE
Unity shader learning (I) understanding the basic structure of unity shader
Unity shader learning (II) the first shader
[worthy of collection] centos7 installation MySQL complete operation command
Excel中输入整数却总是显示小数,如何调整?
【TcaplusDB知识库】TcaplusDB单据受理-建表审批介绍
[tcapulusdb knowledge base] tcapulusdb doc acceptance - Introduction to creating game area
Mqtt protocol stack principle and interaction flow chart
R language uses the polR function of mass package to construct the ordered multi classification logistic regression model, and uses the vglm function of VGAM package to test the parallelism hypothesis
Deep learning in finance in cross sectional sectional predictions for random forests
One copy ten, CVPR oral is accused of plagiarizing a lot
deep learning statistical arbitrage
VPT模型视频讲解
Xuri 3sdb, installing the original ROS
面试突击60:什么情况会导致 MySQL 索引失效?
Native JS implements page scroll bar loading data and page drop-down loading content
After Jerry's sleep, the regular wake-up system continues to run without resetting [chapter]