Add java-go funcs
This commit is contained in:
parent
157b49ed85
commit
07e7c8845d
@ -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 };
|
||||||
|
Loading…
Reference in New Issue
Block a user