Created
May 12, 2017 07:59
-
-
Save anteburazer/cf55f919948fcd9153c8a39298d7b3e8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export abstract class Sandbox { | |
protected loggedUser$ = this.appState$.select(store.getLoggedUser); | |
constructor(protected appState$: Store<store.State>) {} | |
/** | |
* Returns complete or partial state from the store | |
* | |
* @param store | |
* @param property | |
*/ | |
export function getState(store: Store<State>, property?: string): State { | |
let state: State; | |
store.take(1).subscribe(s => state = s); | |
return property ? state[property] : state; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment