[RxJS] Marble diagrams in ASCII form
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的更多相关文章
- [RxJS] Introduction to RxJS Marble Testing
Marble testing is an expressive way to test observables by utilizing marble diagrams. This lesson wi ...
- Reading RxJava Marble Diagrams
------>表示一个Observable(承时间推移,由左入右,左边item先发射) ------>上面的图形,表示这个Observable发射的item ------>上的的|( ...
- RxJS——Operators
RxJS 的操作符(operators)是最有用的,尽管 Observable 是最基本的.操作符最基本的部分(pieces)就是以申明的方式允许复杂的异步代码组合简化. 什么是操作符? 操作符是函数 ...
- RxJS v6 学习指南
为什么要使用 RxJS RxJS 是一套处理异步编程的 API,那么我将从异步讲起. 前端编程中的异步有:事件(event).AJAX.动画(animation).定时器(timer). 异步常见的问 ...
- RxJS库
介绍 RxJS是一个异步编程的库,同时它通过observable序列来实现基于事件的编程.它提供了一个核心的类型:Observable,几个辅助类型(Observer,Schedulers,Subje ...
- RxJS入门
一.RxJS是什么? 官方文档使用了一句话总结RxJS: Think of RxJS as Lodash for events.那么Lodash主要解决了什么问题?Lodash主要集成了一系列关于数组 ...
- react programming
So you're curious in learning this new thing called Reactive Programming, particularly its variant c ...
- Angular 4+ 修仙之路
Angular 4.x 快速入门 Angular 4 快速入门 涉及 Angular 简介.环境搭建.插件表达式.自定义组件.表单模块.Http 模块等 Angular 4 基础教程 涉及 Angul ...
- 响应式编程(Reactive Programming)(Rx)介绍
很明显你是有兴趣学习这种被称作响应式编程的新技术才来看这篇文章的. 学习响应式编程是很困难的一个过程,特别是在缺乏优秀资料的前提下.刚开始学习时,我试过去找一些教程,并找到了为数不多的实用教程,但是它 ...
随机推荐
- learn-python3
# learn-python3 这是我初学Python时写的一套Python基础示例程序.主要基于廖雪峰老师的Python3教程和<<深入理解Python>>. 感谢! 下 ...
- Servlet 小试牛刀(doGet,doPost)
实验说明: 通过javax.servlet.http下的HttpServlet,HttpServletRequest,HttpServletResponse来完成一些常用Servlet实例 java代 ...
- 如何设置路由器实现静态IP配置
一.概述 嵌入式开发者,经常面对这样的环境:PC(windows)+虚拟机(linux)+开发板.我们希望三者都能相互通信,而且可以联网. 对于实验室只提供一根网线,而自己没有额外的增加端口数量的设备 ...
- bzoj2011: [Ceoi2010]Mp3 Player
Description Georg有个MP3 Player,没有任何操作T秒钟就会锁定,这时按下任意一个键就会变回没锁定的状态,但不会改变频道.只有在没锁定的状态下按键才有可能改变频道. MP3的频道 ...
- ARC - MRC
1. 选择工程 ---> build phases --> .m中添加 -fno-objc-arc
- Quartz1.8.5例子(三)
/* * Copyright 2005 - 2009 Terracotta, Inc. * * Licensed under the Apache License, Version 2.0 (the ...
- 小记,取GB2312汉字的首字母【转】
/// <summary> /// PY 的摘要说明. /// </summary> public class PY { // Fields private string m_ ...
- 跨平台的WatiForSingleObject实现
移植win32程序时,有一个难点就是涉及到内核对象的操作,需要模拟win32的实现. 其中比较奇葩的一个是WaitForSingleObject系列. Linux中没有类似的timeout实现,模拟这 ...
- Sed&awk笔记之awk篇
http://blog.csdn.net/a81895898/article/details/8482333 Awk是什么 Awk.sed与grep,俗称Linux下的三剑客,它们之间有很多相似点,但 ...
- Warm up 2
hdu4619:http://acm.hdu.edu.cn/showproblem.php?pid=4619 题意:题目大意:给你两种纸牌 ,一种水平放置共有n张 ,一种竖直放置共有m张.水平放置的纸 ...