【发布时间】:2016-05-04 23:19:15
【问题描述】:
我有一个可观察的序列,每次调用释放事件发生时,我都会将该事件映射到返回 calllog json 数组的 http 请求。
我需要将调用事件中发出的值与 json 数组结合起来。然而,当 json 数组返回时,调用事件 Observable 已经发出了一个新值。
const agentCallEventStream = Rx.Observable.fromEvent(call realease event)
const agentCallLogStream = agentCallEventStream.flatMap( (agentObj) => {
return Rx.Observable.fromPromise(callLogHelper.getUserCallLogs(agentObj.agentId));
}
// I tried this
const callLogMerged = agentCallLogStream.combineLatest(agentCallEventStream)
// but the event data returned is newer than the call log data returned
我正在寻找操作员或某种方式来保持数据同步
【问题讨论】:
-
你能用输入和预期输出做一个弹珠图吗?
标签: javascript asynchronous reactive-programming rxjs