[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 ...
随机推荐
- MySQL忘记root密码的解决方案
在实际操作中忘记MySQL的root密码是一件令人很头痛的事情,不要急以下的文章就是介绍MySQL的root密码忘记的时候解决方案,我们可以对其进行如下的步骤重新设置,以下就是文章的详细内容描述. ...
- 安装beautifulsoup的奇怪问题
以前用的python2.7,改成3.4以后就重新下载了beatifulsoup4.解压到c:\Python34后.在cmd界面执行python setup.py install安装完成后.想看看安装成 ...
- Win+PHP+IECapt完整实现网页批量截图并创建缩略图
最近在开发一个本地互联网应用的项目,为了增加用户体验,需要在搜索结果左侧显示如图一所示的某个网站的缩略图效果,在网上不停地百度谷歌了一上午后,发现大多数实现少量截图还是可以的,如果大批量的截图总会在中 ...
- innerHTML在IE中报错
问题:开发过程中,用到循环往table里面插入tr标签,然后tr里又循环插入td,在其它浏览器都没问题,但是在IE9及以下版本中都报错: google上得到答案:由于我之前不知道错误的原因,在 ...
- V9 二次开发技术篇之 模型数据库
应V9粉丝的建议,本人今天讲一下 MVC中的M 数据库模型 首先 在 phpcms\model 建一个模型文件test_model.class.php <?phpdefined('IN_PHP ...
- phpcms v9 分页
phpcms的分页很简单,只需在需要分页的地方写入如下代码即可: <div id="pages">{$pages}</div> 连样式都有了,如果你是调用的 ...
- javascript 倒计时代码
<script language="javascript" type="text/javascript"> var interval = 1000; ...
- 一个使用CSocket类的网络通信实例
http://www.cppblog.com/changshoumeng/archive/2010/05/14/115413.html 3.8 一个使用CSocket类的网络通信实例 本例采用CSoc ...
- Windows编程中的若干难点 - Windows程序设计(SDK)007
Windows编程中的若干难点 让编程改变世界 Change the world by program 一个窗口的生与死 我记得有童鞋会问:如果我的程序需要在关闭前让用户判断是否确定要关闭窗口,我应该 ...
- mac 常用的开发工具
http://www.oschina.net/news/53946/mac-dev-tools 要清楚的认识到,我们寻找的不是开始按钮,而是程序入口,任何一个操作系统,用户要做的事情并不是找到开始菜单 ...