标签:
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()
标签:
原文地址:http://www.cnblogs.com/Answer1215/p/5376821.html