game-sdk.js 683 B

1234567891011121314151617181920
  1. /**
  2. * Game Platform SDK
  3. *
  4. * window.GameSDK is injected by the platform before your bundle loads.
  5. * Call it as a global — no import needed.
  6. *
  7. * This package also ships a CLI for publishing:
  8. * game-sdk publish --game-id my-game --name "My Game" --bundle ./bundle.js
  9. *
  10. * const result = await GameSDK.submit(100)
  11. * // { ok: true, rank: 3 }
  12. *
  13. * For TypeScript projects, copy game-sdk.d.ts into your source tree (or
  14. * reference it in tsconfig) to get type checking and autocomplete.
  15. *
  16. * API:
  17. * GameSDK.gameId — string
  18. * GameSDK.getPlayerName() — string
  19. * GameSDK.submit(score) — Promise<{ ok: true, rank } | { ok: false, error }>
  20. */