1
我想輪詢一些返回promise的函數並檢測解析值的變化。我需要以某種方式在此添加interval
運算符。如何檢測承諾價值的變化?
const observer = (newValue) => {
console.log('Change detected', newValue);
}
Observable.fromPromise(getValue())
.distinctUntilChanged((oldValue, newValue) => oldValue == newValue)
.subscribe(observer);
我愛你,老兄! –