Skip to content

Instantly share code, notes, and snippets.

@anteburazer
Created May 12, 2017 07:59
Show Gist options
  • Save anteburazer/cf55f919948fcd9153c8a39298d7b3e8 to your computer and use it in GitHub Desktop.
Save anteburazer/cf55f919948fcd9153c8a39298d7b3e8 to your computer and use it in GitHub Desktop.
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