From 9b02be7e4d370176ebe7462b34756ab5eeef2b1f Mon Sep 17 00:00:00 2001 From: Vincenzo Tilotta Date: Sun, 20 Oct 2019 02:50:32 +0200 Subject: [PATCH 1/2] Definitions of API --- types/gamee-js/gamee-js-tests.ts | 21 ++++ types/gamee-js/index.d.ts | 199 +++++++++++++++++++++++++++++++ types/gamee-js/tsconfig.json | 23 ++++ types/gamee-js/tslint.json | 1 + 4 files changed, 244 insertions(+) create mode 100644 types/gamee-js/gamee-js-tests.ts create mode 100644 types/gamee-js/index.d.ts create mode 100644 types/gamee-js/tsconfig.json create mode 100644 types/gamee-js/tslint.json diff --git a/types/gamee-js/gamee-js-tests.ts b/types/gamee-js/gamee-js-tests.ts new file mode 100644 index 0000000..89a9790 --- /dev/null +++ b/types/gamee-js/gamee-js-tests.ts @@ -0,0 +1,21 @@ +import { gamee } from "gamee-js" + +gamee.gameInit("test",{},[],()=>{},false); +gamee.gameLoadingProgress(50,()=>{}); +gamee.gameReady(()=>{}); +gamee.gameSave("",false,()=>{}); +gamee.getPlatform(); +gamee.loadRewardedVideo(()=>{}); +gamee.logEvent("",""); +gamee.purchaseItem({},()=>{}); +gamee.purchaseItemWithCoins({},()=>{}); +gamee.purchaseItemWithGems({},()=>{}); +gamee.requestBattleData(()=>{}); +gamee.requestPlayerData(()=>{},0); +gamee.requestPlayerReplay(0,()=>{}); +gamee.requestPlayerSaveState(1,()=>{}); +gamee.requestSocial(()=>{},1); +gamee.share({},()=>{}); +gamee.showRewardedVideo(()=>{}); +gamee.updateScore(1,true,()=>{}); +gamee.gameOver({},()=>{},()=>{},false); diff --git a/types/gamee-js/index.d.ts b/types/gamee-js/index.d.ts new file mode 100644 index 0000000..7db0e1f --- /dev/null +++ b/types/gamee-js/index.d.ts @@ -0,0 +1,199 @@ +// Type definitions for gamee-js 2.3 +// Project: https://github.com/gameeapp/gamee-js +// Definitions by: Vincenzo Tilotta +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * @class gamee + */ +export namespace gamee { + /** + * gameInit + * @memberof gamee + * @param {String} controllType + * @param {Object} controllOpts + * @param {String[]} capabilities + * @param {Function} cb + * @param {Boolean} silentMode + */ + function gameInit( + controllType: String, + controllOpts: Object, + capabilities: String[], + cb: Function, + silentMode: Boolean + ): void; + + /** + * gameLoadingProgress + * @memberof gamee + * @param {Number} percentage current loading progress + * @param {Function} [opt_cb] + */ + function gameLoadingProgress(percentage: Number, opt_cb: Function): void; + + /** + * gameReady + * @memberof gamee + * @param {Function} [opt_cb] + */ + function gameReady(opt_cb: Function): void; + + /** + * gameSave + * + * @memberof gamee + * @param {String} data current ingame progress + * @param {Boolean} [opt_share=false] + * @param {Function} [opt_cb] + * + */ + function gameSave(data: String, opt_share: Boolean, opt_cb: Function): void; + + /** + * gameSave + * + * @memberof gamee + * @param {String} data current ingame progress + * @param {Function} [opt_cb] + * + */ + function gameSave(data: String, opt_cb: Function): void; + + /** + * getPlatform + * + * @memberof gamee + * @returns {String} platform type can be android | ios | web | fb + */ + function getPlatform(): String; + + /** + * updateScore + * + * @memberof gamee + * @param {Number} score + * @param {Boolean} [opt_ghostSign=false] If true, score will be updated for ghost instead. + * @param {Function} [opt_cb] + */ + function updateScore( + score: Number, + opt_ghostSign: Boolean, + opt_cb: Function + ): void; + + /** + * gameOver + * + * @memberof gamee + * @param {Function|Object} [opt_replayData] + * @param {Function} [opt_cb] + * @param {Object} [opt_saveState] + * @param {Boolean} [opt_hideOverlay] + */ + function gameOver( + opt_replayData: Function | Object, + opt_cb: Function, + opt_saveState: Object, + opt_hideOverlay: Boolean + ): void; + + /** + * requestSocialData + * + * @memberof gamee + * @param {Function} cb + * @param {Number} NumberOfPlayers + */ + function requestSocial(cb: Function, NumberOfPlayers: Number): void; + + /** + * logEvent + * + * @memberof gamee + * @param {String} eventName + * @param {String} eventValue + */ + function logEvent(eventName: String, eventValue: String): void; + + /** + * requestBattleData + + * @memberof gamee + * @param {Function} cb + */ + function requestBattleData(cb: Function): void; + + /** + * requestPlayerReplay + * + * @memberof gamee + * @param {Number} userID + * @param {Function} cb + */ + function requestPlayerReplay(userID: Number, cb: Function): void; + + /** + * requestPlayerSaveState + * + * @memberof gamee + * @param {Number} userID + * @param {Function} cb + */ + function requestPlayerSaveState(userID: Number, cb: Function): void; + + /** + * purchaseItem + * + * @memberof of gamee + * @param {Object} purchaseDetails + * @param {Function} cb + */ + function purchaseItem(purchaseDetails: Object, cb: Function): void; + + /** + * purchaseItemWithCoins + * @member of gamee + * @param {Object} purchaseDetails + * @param {Function} cb + */ + function purchaseItemWithCoins(purchaseDetails: Object, cb: Function): void; + + /** + * purchaseItemWithGems + * @member of gamee + * @param {Object} purchaseDetails + * @param {Function} cb + */ + function purchaseItemWithGems(purchaseDetails: Object, cb: Function): void; + + /** + * share + * @member of gamee + * @param {Object} shareDetails + * @param {Function} cb + */ + function share(shareDetails: Object, cb: Function): void; + + /** + * loadRewardedVideo + * @member of gamee + * @param {Function} cb + */ + function loadRewardedVideo(cb: Function): void; + + /** + * showRewardedVideo + * @member of gamee + * @param{Function} cb + */ + function showRewardedVideo(cb: Function): void; + + /** + * requestPlayerData + * @member of gamee + * @param{Function} cb + * @param {number} userID + */ + function requestPlayerData(cb: Function, userID: number): void; +} \ No newline at end of file diff --git a/types/gamee-js/tsconfig.json b/types/gamee-js/tsconfig.json new file mode 100644 index 0000000..8cae9fd --- /dev/null +++ b/types/gamee-js/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "gamee-js-tests.ts" + ] +} diff --git a/types/gamee-js/tslint.json b/types/gamee-js/tslint.json new file mode 100644 index 0000000..3db14f8 --- /dev/null +++ b/types/gamee-js/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From f5f0efb54d38733e5c33855ee9f933be77ca955a Mon Sep 17 00:00:00 2001 From: Vincenzo Tilotta Date: Sun, 20 Oct 2019 03:23:19 +0200 Subject: [PATCH 2/2] Types api 2.4.1 --- types/gamee-js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/gamee-js/index.d.ts b/types/gamee-js/index.d.ts index 7db0e1f..9d73966 100644 --- a/types/gamee-js/index.d.ts +++ b/types/gamee-js/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for gamee-js 2.3 +// Type definitions for gamee-js 2.4.1 // Project: https://github.com/gameeapp/gamee-js // Definitions by: Vincenzo Tilotta // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped