1
我發現自己與價值觀和可觀察對象的混合對象。喜歡的東西:RxJS組合最大可觀察對象?
const mixedObject = {
field1: "Hello",
field2: Rx.Observable.of('World'),
field3: Rx.Observable.interval(1000),
};
什麼會做這個對象上有點像combineLatest
獲得普通對象流的最佳方式。
例如,我想這樣做:
Rx.Observable.combineLatest(mixedObject).subscribe(plainObject => {
console.log(plainObject.field1, plainObject.field2, plainObject.field3);
// Outputs:
// > Hello World 0
// > Hello World 1
// > Hello World 2
});