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
时间: 2024-10-10 10:45:43