Add waitgroup for angular loading

This commit is contained in:
cyber-dream 2022-11-02 16:00:02 +03:00
parent 2497563ad6
commit ab37445311
2 changed files with 8 additions and 3 deletions

View File

@ -1,5 +1,6 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit, AfterViewInit } from '@angular/core';
import { Router, RouterEvent } from '@angular/router'; import { Router, RouterEvent } from '@angular/router';
import { GoWebViewInit } from './services/go';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
@ -16,5 +17,8 @@ export class AppComponent implements OnInit{
console.log("here") console.log("here")
}) })
} }
ngAfterViewInit(){
GoWebViewInit()
}
title = 'go-web'; title = 'go-web';
} }

View File

@ -5,6 +5,7 @@ export interface Go extends Window {
GoGetGames: () => Promise<Game[]>; GoGetGames: () => Promise<Game[]>;
GoGetSessions: () => Promise<Session[]> GoGetSessions: () => Promise<Session[]>
GoRunGame: (gameId: string) => void; GoRunGame: (gameId: string) => void;
GoWebViewInit: () => void;
} }
export interface GoCallback extends Window { export interface GoCallback extends Window {
@ -12,7 +13,7 @@ export interface GoCallback extends Window {
GoChangeRoute: (value: string) => void; GoChangeRoute: (value: string) => void;
} }
let { GoGetGames, GoRunGame, GoGetSessions } = window as unknown as Go; let { GoGetGames, GoRunGame, GoGetSessions, GoWebViewInit } = window as unknown as Go;
let { SetVersion, GoChangeRoute } = window as unknown as GoCallback; let { SetVersion, GoChangeRoute } = window as unknown as GoCallback;
let w = window as unknown as GoCallback; let w = window as unknown as GoCallback;
@ -35,4 +36,4 @@ let w = window as unknown as GoCallback;
document.dispatchEvent(event); document.dispatchEvent(event);
}; };
export { GoGetGames, GoGetSessions, SetVersion, GoRunGame, GoChangeRoute }; export { GoGetGames, GoGetSessions, SetVersion, GoRunGame, GoChangeRoute, GoWebViewInit };