Besides switch and mergeAll, RxJS also provides concatAll as a flattening operator. In this lesson we will see how concatAll handles concurrent inner Observables and how it is just mergeAll(1).

const clickObservable = Rx.Observable
.fromEvent(document, 'click'); const clockObservable = clickObservable
.map(click => Rx.Observable.interval().take())
.concatAll(); // the same as .mergeAll(1) // flattening
// Observable<Observable<number>> ---> Observable<number> /*
--------+--------------+-+----
\
-0-1-2-3-4| concatAll ----------0-1-2-3-4-----0-1-2-3-4--0-1-2-3-4
*/ clockObservable
.subscribe(x => console.log(x));

[RxJS] Flatten a higher order observable with concatAll in RxJS的更多相关文章

  1. [RxJS] Flatten a higher order observable with mergeAll in RxJS

    Among RxJS flattening operators, switch is the most commonly used operator. However, it is important ...

  2. [React] Higher Order Components (replaces Mixins)

    Higher order components will allow you to apply behaviors to multiple React components. So the idea ...

  3. [React] Implement a Higher Order Component with Render Props

    When making a reusable component, you'll find that people often like to have the API they're most fa ...

  4. [Redux] Understand Redux Higher Order Reducers

    Higher Order Reducers are simple reducer factories, that take a reducer as an argument and return a ...

  5. [React Intl] Use a react-intl Higher Order Component to format messages

    In some cases, you might need to pass a string from your intl messages.js file as a prop to a compon ...

  6. [React] Cleanly Map Over A Stateless Functional Component with a Higher Order Component

    In this lesson we'll create a Higher Order Component (HOC) that takes care of the key property that ...

  7. [CS61A] Lecture 5&6&7. Environments & Design & Functions Examples & Homework 2: Higher Order Functions

    [CS61A] Lecture 5&6&7. Environments & Design & Functions Examples & Homework 2: ...

  8. ng-packagr 打包报错 Public property X of exported class has or is using name 'Observable' from external module “/rxjs/internal/Observable” but cannot be named

    old import { Injectable } from '@angular/core'; import { BehaviorSubject } from 'rxjs'; @Injectable( ...

  9. [Vue-rx] Watch Vue.js v-models as Observable with $watchAsObservable and RxJS

    You most likely already have data or properties in your template which are controlled by third-party ...

随机推荐

  1. 利用js 获取本日 本周 本月时间代码

    function showToDay() { var Nowdate=new Date(); M=Number(Nowdate.getMonth())+1 alert(Nowdate.getMonth ...

  2. 体验SUSE (附视频演示)

    操作动画演示 本文出自 "李晨光原创技术博客" 博客,谢绝转载!

  3. js-YDUI 移动端解决方案

    /** * YDUI 可伸缩布局方案 * rem计算方式:设计图尺寸px / 100 = 实际rem 例: 100px = 1rem */ !function (window) { /* 设计图文档宽 ...

  4. Mining Station on the Sea (hdu 2448 SPFA+KM)

    Mining Station on the Sea Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Jav ...

  5. 读《互联网创业password》之随想

    活动地址:http://blog.csdn.net/blogdevteam/article/details/38657235. 现如今.互联网已经深深的影响了中国人的日常生活习惯,曾经那种通过网络进行 ...

  6. pycharm快捷键、经常使用设置、配置管理

    http://blog.csdn.net/pipisorry/article/details/39909057 本博客一直在同步更新中! 内容包括:pycharm学习技巧 Learning tips. ...

  7. 16、cgminer学习之:popen函数和system函数详解(执行系统命令)

    1.popen函数我们先用man指令查一下popen函数: 函数说明: (1)popen()会调用fork()产生子进程,然后从子进程中调用/bin/sh -c来执行参数command的指令. (2) ...

  8. postman带cookie进行请求

    接口地址: https://m.xxxx.com/api/front/activity/xs/session 打开postman的headers, 然后复制fiddler中接口的cookie,设置co ...

  9. 00087_File

    1.IO概述 (1)要把数据持久化存储,就需要把内存中的数据存储到内存以外的其他持久化设备(硬盘.光盘.U盘等)上: (2)当需要把内存中的数据存储到持久化设备上这个动作称为输出(写)Output操作 ...

  10. 黑马day01 xml 的解析方式

    XML编程:利用java程序去增删改查(CRUD)xml中的数据 解析思想: dom解析 sax解析 基于这两种解析思想市面上就有了非常多的解析api sun jaxp既有dom方式也有sax方式,而 ...