|
|
@ -25,7 +25,7 @@ export default class ComposableObservableStore extends ObservableStore { |
|
|
|
this.config = config |
|
|
|
this.config = config |
|
|
|
this.removeAllListeners() |
|
|
|
this.removeAllListeners() |
|
|
|
for (const key in config) { |
|
|
|
for (const key in config) { |
|
|
|
if (config.hasOwnProperty(key)) { |
|
|
|
if (Object.prototype.hasOwnProperty.call(config, key)) { |
|
|
|
config[key].subscribe((state) => { |
|
|
|
config[key].subscribe((state) => { |
|
|
|
this.updateState({ [key]: state }) |
|
|
|
this.updateState({ [key]: state }) |
|
|
|
}) |
|
|
|
}) |
|
|
@ -42,7 +42,7 @@ export default class ComposableObservableStore extends ObservableStore { |
|
|
|
getFlatState () { |
|
|
|
getFlatState () { |
|
|
|
let flatState = {} |
|
|
|
let flatState = {} |
|
|
|
for (const key in this.config) { |
|
|
|
for (const key in this.config) { |
|
|
|
if (this.config.hasOwnProperty(key)) { |
|
|
|
if (Object.prototype.hasOwnProperty.call(this.config, key)) { |
|
|
|
const controller = this.config[key] |
|
|
|
const controller = this.config[key] |
|
|
|
const state = controller.getState ? controller.getState() : controller.state |
|
|
|
const state = controller.getState ? controller.getState() : controller.state |
|
|
|
flatState = { ...flatState, ...state } |
|
|
|
flatState = { ...flatState, ...state } |
|
|
|