@seznam/seznam.cz-browser-game-module-api
Version:
Abstraction API for integrating video game modules with the Seznam.cz web browser's internal APIs.
47 lines (46 loc) • 1.78 kB
TypeScript
declare global {
interface Window {
sbrowser_games?: AndroidApiBinding;
webkit?: {
messageHandlers?: IOSApiBinding | unknown;
} | unknown;
}
let sbrowser_games: unknown;
let webkit: unknown;
}
declare type AndroidApiBinding = ApiBinding<AndroidApiMethodBinding> & {
isTablet?: AndroidApiMethodBinding | unknown;
};
declare type IOSApiBinding = ApiBinding<IOSApiMethodBinding>;
interface ApiBinding<MethodBinding extends AndroidApiMethodBinding | IOSApiMethodBinding> {
terminateApp?: MethodBinding | unknown;
terminate?: MethodBinding | unknown;
gamesPlay?: MethodBinding | unknown;
gamesExit?: MethodBinding | unknown;
submitUsageStatistics?: MethodBinding | unknown;
openLoginForm?: MethodBinding | unknown;
isSignedIn?: MethodBinding | unknown;
storage_get?: MethodBinding | unknown;
storage_set?: MethodBinding | unknown;
storage_delete?: MethodBinding | unknown;
}
interface AndroidApiMethodBinding {
(...args: unknown[]): unknown;
}
interface IOSApiMethodBinding {
postMessage?: ((serializedData: string) => void) | unknown;
}
export declare function isTablet(): boolean;
export declare function terminateApp(): boolean;
export declare function gamesPlay(gameId: string): void;
export declare function gamesExit(): boolean;
export declare function submitUsageStatistics(gameId: string, gamesPlayed: number, gamesWon: number): boolean;
export declare function openLoginForm(): boolean;
export declare function isSignedIn(): Promise<boolean>;
export interface Storage {
get(key: string): Promise<unknown | null>;
set(key: string, value: unknown): Promise<void>;
delete(key: string): Promise<void>;
}
export declare function getStorage(): Storage | null;
export {};