diff --git a/types/fbinstant/fbinstant-tests.ts b/types/facebook-instant-games/fbinstant-tests.ts similarity index 95% rename from types/fbinstant/fbinstant-tests.ts rename to types/facebook-instant-games/fbinstant-tests.ts index f4a72ea70e..8d33e2c970 100644 --- a/types/fbinstant/fbinstant-tests.ts +++ b/types/facebook-instant-games/fbinstant-tests.ts @@ -1,6 +1,4 @@ -declare const FBInstant: FBInstant; - -export class FBInstantTest { +class FBInstantTest { winStreak: number; init() { diff --git a/types/fbinstant/index.d.ts b/types/facebook-instant-games/index.d.ts similarity index 76% rename from types/fbinstant/index.d.ts rename to types/facebook-instant-games/index.d.ts index 9b337bbc5e..4239c134fb 100644 --- a/types/fbinstant/index.d.ts +++ b/types/facebook-instant-games/index.d.ts @@ -1,40 +1,38 @@ -// Type definitions for FBInstant 6.1 +// Type definitions for facebook-instant-games 6.1 // Project: https://developers.facebook.com/docs/games/instant-games // Definitions by: Menushka Weeratunga // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare class FBInstant { - player: FBInstant.Player; - context: FBInstant.Context; - payments: FBInstant.Payments; - - getLocale(): string; - getPlatform(): string; - getSDKVersion(): string; - initializeAsync(): Promise; - setLoadingProgress(progress: number): void; - getSupportedAPIs(): string[]; - getEntryPointData(): any; - getEntryPointAsync(): Promise; - setSessionData(sessionData: any): void; - startGameAsync(): Promise; - shareAsync(payload: FBInstant.SharePayload): Promise; - updateAsync(payload: FBInstant.UpdatePayload): Promise; - switchGameAsync(appID: string, data: string): Promise; - canCreateShortcutAsync(): Promise; - createShortcutAsync(): Promise; - quit(): void; - logEvent(eventName: string, valueToSum?: number, parameter?: any): FBInstant.APIError; - onPause(func: () => void): void; - getInterstitialAdAsync(placementID: string): Promise; - getRewardedVideoAsync(placementID: string): Promise; - matchPlayerAsync(matchTag: string, switchContextWhenMatched?: boolean): Promise; - checkCanPlayerMatchAsync(): Promise; - getLeaderboardAsync(name: string): Promise; -} - declare namespace FBInstant { - class Player { + let player: Player; + let context: Context; + let payments: Payments; + + function getLocale(): string; + function getPlatform(): string; + function getSDKVersion(): string; + function initializeAsync(): Promise; + function setLoadingProgress(progress: number): void; + function getSupportedAPIs(): string[]; + function getEntryPointData(): any; + function getEntryPointAsync(): Promise; + function setSessionData(sessionData: any): void; + function startGameAsync(): Promise; + function shareAsync(payload: SharePayload): Promise; + function updateAsync(payload: UpdatePayload): Promise; + function switchGameAsync(appID: string, data: string): Promise; + function canCreateShortcutAsync(): Promise; + function createShortcutAsync(): Promise; + function quit(): void; + function logEvent(eventName: string, valueToSum?: number, parameter?: any): APIError; + function onPause(func: () => void): void; + function getInterstitialAdAsync(placementID: string): Promise; + function getRewardedVideoAsync(placementID: string): Promise; + function matchPlayerAsync(matchTag: string, switchContextWhenMatched?: boolean): Promise; + function checkCanPlayerMatchAsync(): Promise; + function getLeaderboardAsync(name: string): Promise; + + interface Player { getID(): string; getSignedPlayerInfoAsync(requestPayload: string): Promise; canSubscribeBotAsync(): Promise; @@ -50,7 +48,7 @@ declare namespace FBInstant { getConnectedPlayersAsync(): Promise; } - class Context { + interface Context { getID(): string; getType(): Type; isSizeBetween(minSize: number, maxSize: number): ContextSizeResponse; @@ -60,7 +58,7 @@ declare namespace FBInstant { getPlayersAsync(): Promise; } - class Leaderboard { + interface Leaderboard { getName(): string; getContextID(): string; getEntryCountAsync(): Promise; @@ -69,7 +67,7 @@ declare namespace FBInstant { getEntriesAsync(count: number, offset: number): Promise; } - class LeaderboardEntry { + interface LeaderboardEntry { getScore(): number; getFormattedScore(): string; getTimestamp(): number; @@ -78,36 +76,36 @@ declare namespace FBInstant { getPlayer(): LeaderboardPlayer; } - class LeaderboardPlayer { + interface LeaderboardPlayer { getName(): string; getPhoto(): string; getID(): string; } - class ConnectedPlayer { + interface ConnectedPlayer { getID(): string; getName(): string; getPhoto(): string; } - class SignedPlayerInfo { + interface SignedPlayerInfo { getPlayerID(): string; getSignature(): string; } - class ContextPlayer { + interface ContextPlayer { getID(): string; getName(): string; getPhoto(): string; } - class AdInstance { + interface AdInstance { getPlacementID(): string; loadAsync(): Promise; showAsync(): Promise; } - class Payments { + interface Payments { purchaseAsync(purchaseConfig: PurchaseConfig): Promise; getPurchasesAsync(): Promise; consumePurchaseAsync(purchaseToken: string): Promise; diff --git a/types/fbinstant/tsconfig.json b/types/facebook-instant-games/tsconfig.json similarity index 100% rename from types/fbinstant/tsconfig.json rename to types/facebook-instant-games/tsconfig.json diff --git a/types/facebook-instant-games/tslint.json b/types/facebook-instant-games/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/facebook-instant-games/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/fbinstant/tslint.json b/types/fbinstant/tslint.json deleted file mode 100644 index 71918edac3..0000000000 --- a/types/fbinstant/tslint.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - // Needs to be declares as it cannot be imported in typescript - // using the standard import statement - "strict-export-declare-modifiers": false - } -}