博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[RxJS] Avoid mulit post requests by using shareReplay()
阅读量:4685 次
发布时间:2019-06-09

本文共 694 字,大约阅读时间需要 2 分钟。

With the shareReplay operator in place, we would no longer fall into the situation where we have accidental multiple HTTP requests.

And this covers the main use cases for doing the most typical read and modification operations, that we would implement while doing a custom REST API.

 

import 'rxjs/add/operator/shareReplay';  signUp(email: string, password: string) {    return this.http.post
('/api/signup', { email, password }).shareReplay() // make sure that request was cached and it return observable .do((user) => this.subject.next(user)); }

 

shareReplay was added to RxJS V5.4

 

More informaiton about .

转载于:https://www.cnblogs.com/Answer1215/p/7266513.html

你可能感兴趣的文章
Centos7下安装Oracle11g r2
查看>>
Centos6.7搭建ISCSI存储服务器
查看>>
[置顶] 全国地区表(树形)
查看>>
协议森林15 先生,要点单吗? (HTTP协议概览)
查看>>
【51nod 1100】斜率最大
查看>>
Tree Control in Dynamics 365 for operation【转】
查看>>
Linux中的目录功能(Red Hat 7)
查看>>
linux swing 乱码
查看>>
.NET中异常处理的最佳实践(转)
查看>>
CentOs 设置静态IP 方法(转)
查看>>
九. 常用类库、向量与哈希2.Object类
查看>>
[Java5新特性]Annotation注解
查看>>
冒泡排序
查看>>
多线程之进度条
查看>>
程序启动的完整过程
查看>>
java资料——哈希表(散列表)(转)
查看>>
反射,invoke()
查看>>
iServer6R使用WMTS自定义比例尺出图
查看>>
pinyin4j的使用
查看>>
Android_ 重写系统Crash处理类,保存Crash信息到SD卡 和 完美退出程序的方法
查看>>