好吧,所以現在我真的很困惑。執行以下代碼rxjs創建可觀察的超時總是錯誤
const created = Rx.Observable.create(observer => {
observer.next(42)
})
const ofd = Rx.Observable.of(42)
const createSub = name => [
val => console.log(`${name} received ${val}`),
error => console.log(`${name} threw ${error.constructor.name}`)
]
created
.timeout(100)
.subscribe(
...createSub('created')
)
ofd
.timeout(100)
.subscribe(
...createSub('ofd')
)
打印
"created received 42"
"ofd received 42"
"created threw TimeoutError"
我不明白這一點在所有的,爲什麼即使它發出一個值,但ofd
可觀察是不是就created
可觀測誤差?
使用RxJS 5時,jsbin.com中的5.0.3和我的應用程序中的5.4.3發生問題。
(注:這種情況與科目太,這使我創造這個例子)
你能分享jsbin代碼嗎? – Maxime
http://jsbin.com/fihotoduqo/1/edit?js,console 它與上面的代碼相同,但 –