Skip to content

Commit

Permalink
refactor: clean up StateFactory code
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Whitfeld committed Apr 27, 2018
1 parent 04643c3 commit 709f460
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions packages/store/src/state-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ export class StateFactory {
private _dispatcher: InternalDispatcher
) {}

private get rootStateOperations(): InternalStateOperations<any> {
return {
getState: () => this._stateStream.getValue(),
setState: newState => this._stateStream.next(newState),
dispatch: actions => this._dispatcher.dispatch(actions)
};
}

/**
* Add a new state to the global defs.
*/
Expand Down Expand Up @@ -136,19 +144,10 @@ export class StateFactory {
);
})
)
.subscribe(ctx => {
this._actionResults.next(ctx);
});
.subscribe(ctx => this._actionResults.next(ctx));
this._connected = true;
}

private get rootStateOperations(): InternalStateOperations<any> {
return {
getState: () => this._stateStream.getValue(),
setState: newState => this._stateStream.next(newState),
dispatch: actions => this._dispatcher.dispatch(actions)
};
}
/**
* Invoke the init function on the states.
*/
Expand Down

0 comments on commit 709f460

Please sign in to comment.