From 07e7c8845df12c9d60385b776e75e69b02114a61 Mon Sep 17 00:00:00 2001 From: wagonsoftware Date: Mon, 17 Oct 2022 16:54:25 +0300 Subject: [PATCH] Add java-go funcs --- src/app/services/go.ts | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/app/services/go.ts b/src/app/services/go.ts index 585898d..5ec794f 100644 --- a/src/app/services/go.ts +++ b/src/app/services/go.ts @@ -1,21 +1,32 @@ +import { Game } from '../interfaces/game.interface'; + export interface Go extends Window { - GetVersion: () => string; + GetGames: () => Promise; } export interface GoCallback extends Window { SetVersion: (value: string) => void; } -let { GetVersion } = window as unknown as Go; +let { GetGames } = window as unknown as Go; let { SetVersion } = window as unknown as GoCallback; -export declare type GetVersionCallbackDetail = string; +let w = window as unknown as GoCallback; -((window)).SetVersion = function (value: string): void { - const event = new CustomEvent('GetVersion_Callback', { - detail: value, - }); - document.dispatchEvent(event); -}; +// var register = function (name: string): void { +// const event = new CustomEvent(`${name}_Callback`, { +// detail: value +// }) +// document.dispatchEvent(event) +// }; -export { GetVersion, SetVersion }; +// w.SetVersion = register('SetVersion') + +// ((window)).SetVersion = function (value: T): void { +// const event = new CustomEvent('GetVersion_Callback', { +// detail: value, +// }); +// document.dispatchEvent(event); +// }; + +export { GetGames, SetVersion };