SDK APIs
Microsoft Start Games SDK APIs.
Load MSSTART SDK
To start using the MSSTART SDK, you can simply load it through CDN. The following code snippet will load and initialize the SDK.
<script src="https://assets.msn.com/staticsb/statics/latest/msstart-games-sdk/msstart-v1.0.0-rc.13.min.js"></script>
Once loaded, you can access the APIs from its namespace object, $msstart.
Objects
- $msstart :
object
The Microsoft Start Games SDK.
Typedefs
- EntryPointInfo :
object
- ShareGameData :
object
- PlayerInfo :
object
- LoadAdOptions :
object
|boolean
- AdInstance :
object
- SwitchGameData :
object
$msstart : object
The Microsoft Start Games SDK.
Kind: global namespace
- $msstart :
object
- .isInMicrosoftStart() ⇒
boolean
- .getEntryPointInfo() ⇒
EntryPointInfo
- .getLocale() ⇒
string
- .getSourceShareId() ⇒
string
- .pingAsync() ⇒
Promise.<string>
- .shareAsync(shareData) ⇒
Promise.<string>
- .promptInstallAsync() ⇒
Promise.<string>
- .signInAsync() ⇒
Promise.<PlayerInfo>
- .getSignedInUserAsync() ⇒
Promise.<PlayerInfo>
- .loadAdsAsync([loadAdOptions]) ⇒
Promise.<AdInstance>
- .showAdsAsync(instanceId) ⇒
Promise.<AdInstance>
- .submitGameResultsAsync(primaryStatValue) ⇒
Promise.<boolean>
- .switchGameAsync(switchGameData) ⇒
Promise.<never>
- .showDisplayAdsAsync(displayAdPlacement) ⇒
Promise.<string>
- .hideDisplayAdsAsync() ⇒
Promise.<string>
- .getConsentStringAsync() ⇒
Promise.<string>
- .isInMicrosoftStart() ⇒
$msstart.isInMicrosoftStart() ⇒ boolean
A function that can be used to test whether the game is currently running within Microsoft Start.
Kind: static method of $msstart
$msstart.getEntryPointInfo() ⇒ EntryPointInfo
Returns information about the entry point from which the game was launched.
Kind: static method of $msstart
$msstart.getLocale() ⇒ string
Returns the a lower cased locale value that the game should use to localize in-game experiences.
Kind: static method of $msstart
$msstart.getSourceShareId() ⇒ string
Returns the id of shared game event.
Kind: static method of $msstart
$msstart.pingAsync() ⇒ Promise.<string>
An API that allows a game to ping Microsoft Start Games to test the connection between the container and itself.
Kind: static method of $msstart
$msstart.shareAsync(shareData) ⇒ Promise.<string>
An API that invokes a share flow on Microsoft Start Games.
Kind: static method of $msstart
Param | Type |
---|---|
shareData | ShareGameData |
$msstart.promptInstallAsync() ⇒ Promise.<string>
An API that invokes a PWA install prompt flow on Microsoft Start Games. It will display a dialog modal and wait until the user either confirms or cancels the install.
Kind: static method of $msstart
$msstart.signInAsync() ⇒ Promise.<PlayerInfo>
An API that invokes a sign in prompt flow on Microsoft Start Games. It will display a dialog modal and wait until the user either signs in or dismisses the dialog
Kind: static method of $msstart
$msstart.getSignedInUserAsync() ⇒ Promise.<PlayerInfo>
An API that allows a game to retrieve signed in users Player Id associated with Microsoft Start Games.
Kind: static method of $msstart
$msstart.loadAdsAsync([loadAdOptions]) ⇒ Promise.<AdInstance>
An API that loads ad instance.
Kind: static method of $msstart
Param | Type | Description |
---|---|---|
[loadAdOptions] | LoadAdOptions | (Optional) An object that contains options for loading ads. |
$msstart.showAdsAsync(instanceId) ⇒ Promise.<AdInstance>
An API that shows loaded ad instance.
Kind: static method of $msstart
Param | Type |
---|---|
instanceId | string |
$msstart.submitGameResultsAsync(primaryStatValue) ⇒ Promise.<boolean>
An API that submits the user's game results.
Kind: static method of $msstart
Param | Type | Description |
---|---|---|
primaryStatValue | Number | The raw value of the primary stat used for leaderboard rankings. For time scores, use milliseconds. |
$msstart.switchGameAsync(switchGameData) ⇒ Promise.<never>
An API that invokes a switch game flow on Microsoft Start Games. The API never resolves because it immediately starts the new game that was passed as an argument. The game switched to can access the data from the previous game through the $msstart.switchGamePayload, which contains the payload that was sent when the API was invoked.
Kind: static method of $msstart
Param | Type |
---|---|
switchGameData | SwitchGameData |
$msstart.showDisplayAdsAsync(displayAdPlacement) ⇒ Promise.<string>
An API that invokes to show a display ad over the game
Kind: static method of $msstart
Param | Type | Description |
---|---|---|
displayAdPlacement | "top:728x90" | "left:300x250" | "right:300x250" | "topleft:300x250" | "topright:300x250" | "bottomleft:300x250" | "bottomright:300x250" | "top:320x50" | "right:320x50" | "bottom:320x50" | "left:320x50" | "left:300x600" | "right:300x600" | "top:970x250" | "left:160x600" | "right:160x600" | The allowed values of the display ad placement |
$msstart.hideDisplayAdsAsync() ⇒ Promise.<string>
An API that invokes to hide display ads over the game
Kind: static method of $msstart
$msstart.getConsentStringAsync() ⇒ Promise.<string>
An API that allows a game to get the consent string from the parent container. This API currently returns the consent string only in EU countries.
Kind: static method of $msstart
See: https://iabtechlab.com/gpp/ for more details.
EntryPointInfo : object
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
entryPointId | string | A raw unique identifier for the entry point. |
entryPointName | string | A human-friendly name for the entry point. |
ShareGameData : object
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
[title] | string | A title to be used in a share preview. |
[text] | string | Text as a description to be used in a share preview. |
[image] | string | An image to be used in a share preview. This can either be a URL or base64 string representation of an image. |
PlayerInfo : object
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
playerId | string | PlayerId associated with user in Microsoft Start Games. |
LoadAdOptions : object
| boolean
Kind: global typedef
Comment: If LoadAdOptions is a boolean, it is equivalent to setting isRewardedAd to that value
Properties
Name | Type | Description |
---|---|---|
[isRewardedAd] | boolean | A boolean value that indicates whether the request is for a rewarded ad. |
[canBackfill] | boolean | A boolean value that indicates whether the unfulfilled ad request can be backfilled by the caller. |
AdInstance : object
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
instanceId | string | A unique id for the ad instance. |
showAdsCompletedAsync | Promise.<AdInstance> | A promise for the completion of showing the ad instance. showAdsCompletedAsync will be present only when showAds resolves. |
SwitchGameData : object
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
id | string | The id of the game to switch to. |
[payloadData] | object | The payload data we send to the game we switch to. |