Heya ya'll,
I noticed that we didn't have any TypeScript bindings for the JavaScript SDK.
So I made a defs file!
declare module "gamesparks" { export class GameSparksBrowserData { string : string; subString : string; identity : string; versionSearch? : string; } export class GameSparksOperatingSystemData { string: string; subString : string; identity: string; } export function init(options : any): void; export function initPreview (options : any): void; export function initLive (options : any): void; export function connect(): void; export function disconnect(): void; export function onWebSocketOpen(callback : () => void): void; export function onWebSocketClose(callback : () => void): void; export function onWebSocketMessage(message : any): void; export function handshake (result : any): void; export function keepAlive(): void; export function send(requestType : string, onResponseCallback : (response : any) => void): void; export function sendWithData(requestType : string, payload : any, onResponseCallback : (response : any) => void): void; export function webSocketSend(data : any): void; export function getSocketUrl(): string; export function getSessionId(): string; export function getAuthToken(): string; export function setAuthToken(token : string): void; export function isConnected(): boolean; export function log(message : string): void; export function getBrowserData(): { browser : GameSparksBrowserData, operatingSystem : GameSparksOperatingSystemData}; }
Thanks, Ryan,
This is what we ended up doing as well ;)
Best Regards
I started to convert JS SDK files to TypeScript to use it with NativeScript. https://gist.github.com/muratcorlu/f5a9da629b3a727dec772844cc545fd8
Ryan George
Heya ya'll,
I noticed that we didn't have any TypeScript bindings for the JavaScript SDK.
So I made a defs file!