Guest User

Untitled

a guest
Feb 17th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. /**
  2. * App Initializer with Effects
  3. */
  4.  
  5. export function initApplication(store: Store<AppState>) {
  6. return () =>
  7. new Promise(resolve => {
  8. const loaded$ = new Subject();
  9. store.dispatch(new LoadSystem());
  10. store
  11. .select((state:AppState) => state.isLoaded)
  12. .pipe(takeUntil(loaded$))
  13. .subscribe(loaded => {
  14. if (loaded) {
  15. loaded$.next();
  16. resolve();
  17. }
  18. });
  19. });
  20. }
Add Comment
Please, Sign In to add comment