[RxJS] Creation operator: of()
RxJS is a lot about the so-called "operators". We will learn most of the important operators, one by one. In this lesson, we will see our first creation operator: of().
var foo = Rx.Observable.of(42, 100, 200);
// var bar = Rx.Observable.create(function (observer) {
// observer.next(42);
// observer.next(100);
// observer.next(200);
// observer.complete();
// });
foo.subscribe(function (x) {
console.log('next ' + x);
}, function (err) {
console.log('error ' + err);
}, function () {
console.log('done');
});
/*
"next 42"
"next 100"
"next 200"
"done"
*/
[RxJS] Creation operator: of()的更多相关文章
- [RxJS] Creation operator: create()
We have been using Observable.create() a lot in previous lessons, so let's take a closer look how do ...
- rxjs自定义operator
rxjs自定义operator
- [RxJS] Connection operator: multicast and connect
We have seen how Subjects are useful for sharing an execution of an RxJS observable to multiple obse ...
- [RxJS] Transformation operator: repeat
Operator repeat() is somewhat similar to retry(), but is not for handling operators. In this lesson ...
- [RxJS] Transformation operator: buffer, bufferCount, bufferTime
This lesson will teach you about another horizontal combination operator: buffer and its variants. B ...
- [RxJS] Transformation operator: scan
All of the combination operators take two or more observables as input. These operators may also be ...
- [RxJS] Combination operator: withLatestFrom
Operator combineLatest is not the only AND-style combinator. In this lesson we will explore withLate ...
- [RxJS] Combination operator: combineLatest
While merge is an OR-style combination operator, combineLatest is an AND-style combination operator. ...
- [RxJS] Filtering operator: filter
This lesson introduces filter: an operator that allows us to let only certain events pass, while ign ...
随机推荐
- DotNet中的计时器线程计时器
转载自:http://hi.baidu.com/wingingbob/item/9f1c9615f3b24d5f2b3e225c 基于多线程设计,计时器工作在ThreadPool线程上,存在事件的重入 ...
- Dragger简介
转自:http://www.apkbus.com/blog-705730-60435.html 什么是依赖注入 如果我们想要注入依赖,首先要理解依赖是什么.简单的说,依赖是我们代码中两个模块之间的耦合 ...
- 常用语句1【weber出品】
1.查看控制文件位置: select * from v$controlfile show parameter control; 2.查询日志文件位置 select group#,status,mem ...
- 【转】深入理解Java内存模型(二)——重排序
数据依赖性 如果两个操作访问同一个变量,且这两个操作中有一个为写操作,此时这两个操作之间就存在数据依赖性.数据依赖分下列三种类型: 名称 代码示例 说明 写后读 a = 1;b = a; 写一个变量之 ...
- sqlserver2012 评估期已过问题处理
由于之前安装sqlserver2012忘记输入序列号,现在出现评估期已过的问题,网上忙活半天,才解决,发现网上叙述都很凌乱,而且只有大意,新手很难操作,所以把我操作的过程分享给大家 1 开始菜单找到s ...
- mysql 数据库字符串替换
UPDATE `table_name` SET `field_name` = replace (`field_name`,'from_str','to_str') WHERE `field_name` ...
- JNDI--Java命名和目录接口
JNDI主要用于在容器中配置某些资源,让所有项目可以使用.JNDI可以提供: 1:数据库连接池. 自定义连接池 第三方连接池 Dbcp ...
- String类扩展
String s1=new String("fsdfsd"); String s2=new String("fsdfsd"); String a1=" ...
- 3D dungeon
算法:广搜: 描述 You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is comp ...
- delphi列表视图组件(TListView)使用方法|实例
TListView 组件以多种形式显示列表的项目,如详细资料.小图标.大图标等形式表示列表中的项目. 列表视图与用TListBox 组件实现的列表框非常相似.不同的是,列表视图可以让用户选择不同 ...