From 6f16968bfb8dab0c3c8817f63843743390e64085 Mon Sep 17 00:00:00 2001 From: Mark Whitfeld Date: Fri, 27 Apr 2018 21:58:14 +0200 Subject: [PATCH] refactor: clean up StateFactory code --- packages/store/src/state-factory.ts | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/packages/store/src/state-factory.ts b/packages/store/src/state-factory.ts index 1cda38a0e..017db1ec5 100644 --- a/packages/store/src/state-factory.ts +++ b/packages/store/src/state-factory.ts @@ -43,6 +43,14 @@ export class StateFactory { private _dispatcher: InternalDispatcher ) {} + private get rootStateOperations(): InternalStateOperations { + 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. */ @@ -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 { - return { - getState: () => this._stateStream.getValue(), - setState: newState => this._stateStream.next(newState), - dispatch: actions => this._dispatcher.dispatch(actions) - }; - } /** * Invoke the init function on the states. */