码迷,mamicode.com
首页 > Web开发 > 详细

[RxJS] just, return

时间:2016-08-14 07:28:29      阅读:210      评论:0      收藏:0      [点我收藏+]

标签:

Sometime, we migth just want to return a object which wrap into Observable. You can use ‘just‘ or  ‘return‘.

 

var source = Rx.Observable.return(42);

var subscription = source.subscribe(
    function (x) {
        console.log(Next:  + x);
    },
    function (err) {
        console.log(Error:  + err);   
    },
    function () {
        console.log(Completed);   
    });

// => Next: 42 
// => Completed 

 

[RxJS] just, return

标签:

原文地址:http://www.cnblogs.com/Answer1215/p/5769134.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!