Add java-go funcs

This commit is contained in:
wagonsoftware 2022-10-17 16:54:25 +03:00
parent 157b49ed85
commit 07e7c8845d

View File

@ -1,21 +1,32 @@
import { Game } from '../interfaces/game.interface';
export interface Go extends Window { export interface Go extends Window {
GetVersion: () => string; GetGames: () => Promise<Game[]>;
} }
export interface GoCallback extends Window { export interface GoCallback extends Window {
SetVersion: (value: string) => void; 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; let { SetVersion } = window as unknown as GoCallback;
export declare type GetVersionCallbackDetail = string; let w = window as unknown as GoCallback;
(<GoCallback>(<unknown>window)).SetVersion = function (value: string): void { // var register = function <Type>(name: string): void {
const event = new CustomEvent<string>('GetVersion_Callback', { // const event = new CustomEvent<Type>(`${name}_Callback`, {
detail: value, // detail: value
}); // })
document.dispatchEvent(event); // document.dispatchEvent(event)
}; // };
export { GetVersion, SetVersion }; // 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);
// };
export { GetGames, SetVersion };