首页 > 解决方案 > 来自不同管道的 RxJs globalState

问题描述

我需要有不同的管道/分支链才能修改一个全局状态。

如何避免在分支内部冒泡全局状态更改事件?

如何改进这种惯用 RxJS 的方法

const globalState = {}

const br_one_step1$ = globalStateChange$.map(modGlobState_br_one_step1)
const br_one_step2$ = br_one_step1$.map(modGlobState_br_one_step2)
const br_one_step3$ = br_one_step2$.map(modGlobState_br_one_step3)
br_one_step3$.subscribe()

const br_two_step1$ = globalStateChange$.map(modGlobState_br_two_step1)
const br_two_step2$ = br_two_step1$.map(modGlobState_br_two_step2)
const br_two_step3$ = br_two_step2$.map(modGlobState_br_two_step3)
br_two_step3$.subscribe()```

标签: rxjs

解决方案


推荐阅读