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()的更多相关文章

  1. [RxJS] Creation operator: create()

    We have been using Observable.create() a lot in previous lessons, so let's take a closer look how do ...

  2. rxjs自定义operator

    rxjs自定义operator

  3. [RxJS] Connection operator: multicast and connect

    We have seen how Subjects are useful for sharing an execution of an RxJS observable to multiple obse ...

  4. [RxJS] Transformation operator: repeat

    Operator repeat() is somewhat similar to retry(), but is not for handling operators. In this lesson ...

  5. [RxJS] Transformation operator: buffer, bufferCount, bufferTime

    This lesson will teach you about another horizontal combination operator: buffer and its variants. B ...

  6. [RxJS] Transformation operator: scan

    All of the combination operators take two or more observables as input. These operators may also be ...

  7. [RxJS] Combination operator: withLatestFrom

    Operator combineLatest is not the only AND-style combinator. In this lesson we will explore withLate ...

  8. [RxJS] Combination operator: combineLatest

    While merge is an OR-style combination operator, combineLatest is an AND-style combination operator. ...

  9. [RxJS] Filtering operator: filter

    This lesson introduces filter: an operator that allows us to let only certain events pass, while ign ...

随机推荐

  1. C#中如何获取系统环境变量等

    C#中获取系统环境变量需要用到Environment 类. 其中提供了有关当前环境和平台的信息以及操作它们的方法.该类不能被继承 以下代码得到%systemdrive%的值,即“C:” string ...

  2. iOS 网络与多线程--2.同步Get方式的网络请求(阻塞)

    通过Get请求方式同步获取网络数据.一旦发送同步请求,程序将停止用户交互,直至服务器返回数据. 之后在视图控制器文件(ViewController.m)内添加以下代码 在viewDidLoad函数内添 ...

  3. 一些SQL语句的问题

    1.getdate()函数问题 go create table table_1( id int primary key identity, name ) not null, daytime datet ...

  4. 编辑一个类库项目 即*.csproj这个文件的正确方式

    以前总是用记事本打开,删除一些或增加一些已修改的文件 今天才知道,正确的方式为: 右键单击类库,选择“卸载项目”,然后再右键单击已卸载变为灰色的类库,选择“编辑*.csproj” 编辑完了重新加载一下 ...

  5. CentOS下几种软件安装方式

    1.rpmRPM RedHat Package Manager(RedHat软件包管理工具)的缩写,这一文件格式名称虽然打上了RedHat的标志, 但是其原始设计理念是开放式的,现在包括OpenLin ...

  6. 【Beta】阶段汇总

    [项目文档&API文档] PhyLab2.0需求与功能分析改进文档(NABCD) PhyLab2.0设计分析阶段任务大纲(α) 团队个人贡献分分配规则 功能规格说明书 [Phylab2.0]B ...

  7. 网站(Tomcat)超线程宕机

    网站大中午的又挂了····· 拷了日志如下: 2014-4-12 13:22:30 org.apache.tomcat.util.net.JIoEndpoint createWorkerThread信 ...

  8. AndroidManifest.xml 文件里面的内容介绍

    <?xml version="1.0" encoding="utf-8"?> <!--package 包表示整个java应用程序的主要包名,而 ...

  9. 为什么设计模式在C++社区没有Java社区流行?

    我们发现设计模式在Java社区很流行,但是在C++社区却没有那么被关注,甚至有点被排斥,究竟是什么原因造成这个差异的呢?    昨天和同事讨论这个问题,最后得出几点原因:     (1)C++内存需要 ...

  10. 11g v$session定位客户端IP

    11g v$session 新增PORT 字段 用于描述客户端的端口号 客户机从10.5.129.180 访问10.5.128.28 [oracle@cpool ~]$ netstat -na | g ...