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<User>('/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 shareReplay.

[RxJS] Avoid mulit post requests by using shareReplay()的更多相关文章

  1. [RxJS] Reactive Programming - New requests from refresh clicks -- merge()

    Now we want each time we click refresh button, we will get new group of users. So we need to get the ...

  2. [Vue-rx] Disable Buttons While Data is Loading with RxJS and Vue.js

    Streams give you the power to handle a "pending" state where you've made a request for dat ...

  3. dfsdf

    This project was bootstrapped with Create React App. Below you will find some information on how to ...

  4. puppeteer(五)chrome启动参数列表API

    List of Chromium Command Line Switches https://peter.sh/experiments/chromium-command-line-switches/ ...

  5. CEF 支持的命令行参数

    参考:https://peter.sh/experiments/chromium-command-line-switches/ List of Chromium Command Line Switch ...

  6. SpringKafka生产端配置类ProducerConfig.java源码

    /** * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreeme ...

  7. Capabilities & ChromeOptions

    https://sites.google.com/a/chromium.org/chromedriver/capabilities http://stackoverflow.com/questions ...

  8. List of Chromium Command Line Switches(命令行开关集)——官方指定命令行更新网址

    转自:http://peter.sh/experiments/chromium-command-line-switches/ There are lots of command lines which ...

  9. OBD Problem Vehicles

    This page contains a list of vehicles that are known to be non-compliant with OBD-II in one way or a ...

随机推荐

  1. 【Docker自定制镜像之Dockerfile】

    镜像的定制,就是定制每一层所添加的配置.文件,如果可以把每一层修改.安装.构建.操作的命令都写入到一个脚本中,用脚本来构建.定制镜像,这个脚本就是Dockerfile Dockerfile是一个文本文 ...

  2. Java并发包之Semaphore用法

    多线程中的同步概念就是排着队去执行一个任务,执行任务的是一个一个的执行,并不能并行执行,这样的优点是有助于程序逻辑的正确性,不会出现线程安全问题,保证软件的系统功能上的运行稳定性, Semaphore ...

  3. 洛谷 P1877 [HAOI2012]音量调节

    P1877 [HAOI2012]音量调节 题目描述 一个吉他手准备参加一场演出.他不喜欢在演出时始终使用同一个音量,所以他决定每一首歌之前他都需要改变一次音量.在演出开始之前,他已经做好一个列表,里面 ...

  4. 在oracle存储过程中创建暂时表

    在oracle的存储过程中,不能直接使用DDL语句,比方create.alter.drop.truncate等. 那假设我们想在存储过程中建立一张暂时表就仅仅能使用动态sql语句了: create o ...

  5. TensorFlow的学习

    1.先判断python的版本(因为有些python版本自带pip,可以参考我写的对pip的认识的博客文章),选择是否安装pip,然后安装更新tensorflow如:sudo pip install - ...

  6. 关于SQL分页存储过程的分析

    建 立一个 Web 应用,分页浏览功能必不可少.这个问题是数据库处理中十分常见的问题.经典的数据分页方法是:ADO 纪录集分页法,也就是利用ADO自带的分页功能(利用游标)来实现分页.但这种分页方法仅 ...

  7. sql server 内置MD5加密函数

    http://blog.csdn.net/rookie_liu_ToFly/article/details/53116932 select right(sys.fn_VarBinToHexStr(HA ...

  8. 【项目基础】容器、AOP理论篇

    一.容器(砂锅) 1.概念: 容器是应用server中位于组件和平台之间的接口集合 2.应用: 容器一般位于应用server之内,由应用server负责载入和维护.一个容器仅仅能存在于一个应用serv ...

  9. Java Reflection - Getters and Setters

    原文链接:http://tutorials.jenkov.com/java-reflection/getters-setters.html 通过使用 Java 反射,我们能够在程序执行时观察 clas ...

  10. ubuntu-smb共享文件创建

    如何在计算机上实现资源共享                         --在本地用户目录下,创建一个smb文件夹                         --右击,选择share opt ...