Add status callback
This commit is contained in:
parent
5d15b7648d
commit
077fe04688
@ -4,7 +4,7 @@
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
"build": "ng build",
|
||||
"build": "ng build --output-hashing none",
|
||||
"watch": "ng build --watch --configuration development",
|
||||
"test": "ng test"
|
||||
},
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Component, OnInit, Input } from '@angular/core';
|
||||
|
||||
import { GoSetStatus } from 'src/app/services/go';
|
||||
@Component({
|
||||
templateUrl: './loading-screen.component.html',
|
||||
styleUrls: ['./loading-screen.component.scss']
|
||||
@ -14,6 +14,10 @@ export class LoadingScreenComponent implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
document.addEventListener('GoSetStatus_Callback', (event:any) => {
|
||||
this.SetStatus(event.detail)
|
||||
console.log("Set loading screen status: " + event.detail)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -12,10 +12,11 @@ export interface Go extends Window {
|
||||
export interface GoCallback extends Window {
|
||||
SetVersion: (value: string) => void;
|
||||
GoChangeRoute: (value: string) => void;
|
||||
GoSetStatus: (value: string) => void;
|
||||
}
|
||||
|
||||
let { GoGetGames, GoRunGame, GoGetSessions, GoRunSession, GoWebViewInit } = window as unknown as Go;
|
||||
let { SetVersion, GoChangeRoute } = window as unknown as GoCallback;
|
||||
let { SetVersion, GoChangeRoute, GoSetStatus } = window as unknown as GoCallback;
|
||||
|
||||
let w = window as unknown as GoCallback;
|
||||
|
||||
@ -37,4 +38,11 @@ let w = window as unknown as GoCallback;
|
||||
document.dispatchEvent(event);
|
||||
};
|
||||
|
||||
export { GoGetGames, GoGetSessions, SetVersion, GoRunGame, GoChangeRoute, GoWebViewInit, GoRunSession };
|
||||
(<GoCallback>(<unknown>window)).GoSetStatus = function <T>(value: T): void {
|
||||
const event = new CustomEvent<T>('GoSetStatus_Callback', {
|
||||
detail: value,
|
||||
});
|
||||
document.dispatchEvent(event);
|
||||
};
|
||||
|
||||
export { GoGetGames, GoGetSessions, SetVersion, GoRunGame, GoChangeRoute, GoSetStatus, GoWebViewInit, GoRunSession };
|
||||
|
Loading…
Reference in New Issue
Block a user