There are many operators available, and in order to understand them we need to have a simple way of communicating how they transform a source Observable into a result Observable over time. Throughout this course we are going to see the so-called marble diagrams.

var foo = Rx.Observable.interval(1000);

/*

foo: ---0---1---2---3--...
multiplyBy(2)
bar: ---0---2---4---6--... */ function multiplyBy(multiplier) {
var source = this;
var result = Rx.Observable.create(function subscribe(observer) {
source.subscribe(
function (x) { observer.next(x * multiplier); },
function (err) { observer.error(err); },
function () { observer.complete(); }
);
});
return result;
} Rx.Observable.prototype.multiplyBy = multiplyBy; var bar = foo.multiplyBy(2); bar.subscribe(
function (x) { console.log('next ' + x); },
function (err) { console.log('error ' + err); },
function () { console.log('done'); },
);

[RxJS] Marble diagrams in ASCII form的更多相关文章

  1. [RxJS] Introduction to RxJS Marble Testing

    Marble testing is an expressive way to test observables by utilizing marble diagrams. This lesson wi ...

  2. Reading RxJava Marble Diagrams

    ------>表示一个Observable(承时间推移,由左入右,左边item先发射) ------>上面的图形,表示这个Observable发射的item ------>上的的|( ...

  3. RxJS——Operators

    RxJS 的操作符(operators)是最有用的,尽管 Observable 是最基本的.操作符最基本的部分(pieces)就是以申明的方式允许复杂的异步代码组合简化. 什么是操作符? 操作符是函数 ...

  4. RxJS v6 学习指南

    为什么要使用 RxJS RxJS 是一套处理异步编程的 API,那么我将从异步讲起. 前端编程中的异步有:事件(event).AJAX.动画(animation).定时器(timer). 异步常见的问 ...

  5. RxJS库

    介绍 RxJS是一个异步编程的库,同时它通过observable序列来实现基于事件的编程.它提供了一个核心的类型:Observable,几个辅助类型(Observer,Schedulers,Subje ...

  6. RxJS入门

    一.RxJS是什么? 官方文档使用了一句话总结RxJS: Think of RxJS as Lodash for events.那么Lodash主要解决了什么问题?Lodash主要集成了一系列关于数组 ...

  7. react programming

    So you're curious in learning this new thing called Reactive Programming, particularly its variant c ...

  8. Angular 4+ 修仙之路

    Angular 4.x 快速入门 Angular 4 快速入门 涉及 Angular 简介.环境搭建.插件表达式.自定义组件.表单模块.Http 模块等 Angular 4 基础教程 涉及 Angul ...

  9. 响应式编程(Reactive Programming)(Rx)介绍

    很明显你是有兴趣学习这种被称作响应式编程的新技术才来看这篇文章的. 学习响应式编程是很困难的一个过程,特别是在缺乏优秀资料的前提下.刚开始学习时,我试过去找一些教程,并找到了为数不多的实用教程,但是它 ...

随机推荐

  1. wamp安装注意点!

    安装wamp前或者重装系统后,默认没有依赖的组件VC11,需要先安装才能运行 下载地址:http://www.microsoft.com/en-us/download/details.aspx?id= ...

  2. Safari浏览器的调试

    最近做浏览器兼容的时候发现Safari的脚本调试工具比较难找,因此与大家分享一下 1.找到脚本调试的选项 2.勾选此选项 3.在页面空白处右击打开调试窗口 4.看到下方的调试窗口了 细心的读者会发现, ...

  3. Xcode-程序开发设计-02九宫格

    行号是除 决定Y值 列号是余 决定X值 // // ViewController.m // 06-应用管理 // // Created by daier on 15/12/31. // Copyrig ...

  4. Maven工程的Web调试

    1.添加Server,将Web工程和Tomcat关联起来: 1)Windows->Show views->Other-->Servers,将会在下方弹出Server的窗口,然后右键添 ...

  5. The Greate Wall 相关网络知识(一)域名劫持

    什么叫做DNS? DNS(Domain Name System,域名系统),因特网上作为域名和IP地址相互映射的一个分布式数据库,能够使用户更方便的访问互联网,而不用去记住能够被机器直接读取的IP数串 ...

  6. SendMail

    public ActionResult SendMail() { MailMessage mss = new MailMessage(); mss.From = new MailAddress(&qu ...

  7. iOS:等待控件

    定义: @interface ViewController () { UIActivityIndicatorView *testActivityIndicator; } 实例化,开始旋转: -(voi ...

  8. bzoj 1501: [NOI2005]智慧珠游戏 Dancing Link

    1501: [NOI2005]智慧珠游戏 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 190  Solved: 122[Submit][Status] ...

  9. BZOJ 3676 回文串

    Description 考虑一个只包含小写拉丁字母的字符串\(s\).我们定义\(s\)的一个子串\(t\)的"出现值"为\(t\)在\(s\)中的出现次数乘以\(t\)的长度.请 ...

  10. 更改linux系统时间

    date  //查看时间 date -s '21:04:20 2014-06-06' //将时间设为21:04:20 2014-06-06