add go method to navigate ng routes

This commit is contained in:
cyber-dream 2022-10-31 21:51:06 +03:00
parent 4c50f26050
commit 2049fc8833

View File

@ -9,13 +9,16 @@ export interface Go extends Window {
export interface GoCallback extends Window {
SetVersion: (value: string) => void;
GoChangeRoute: (value: string) => void;
}
let { GoGetGames, GoRunGame, GoGetSessions } = window as unknown as Go;
let { SetVersion } = window as unknown as GoCallback;
let { SetVersion, GoChangeRoute } = window as unknown as GoCallback;
let w = window as unknown as GoCallback;
// var register = function <Type>(name: string): void {
// const event = new CustomEvent<Type>(`${name}_Callback`, {
// detail: value
@ -25,11 +28,11 @@ let w = window as unknown as GoCallback;
// w.SetVersion = register<string>('SetVersion')
// (<GoCallback>(<unknown>window)).SetVersion = function <T>(value: T): void {
// const event = new CustomEvent<T>('GetVersion_Callback', {
// detail: value,
// });
// document.dispatchEvent(event);
// };
(<GoCallback>(<unknown>window)).GoChangeRoute = function <T>(value: T): void {
const event = new CustomEvent<T>('GoChangeRoute_Callback', {
detail: value,
});
document.dispatchEvent(event);
};
export { GoGetGames, GoGetSessions, SetVersion, GoRunGame };
export { GoGetGames, GoGetSessions, SetVersion, GoRunGame, GoChangeRoute };