Skip to main content

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.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

ParamType
shareDataShareGameData

$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

ParamTypeDescription
[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

ParamType
instanceIdstring

$msstart.submitGameResultsAsync(primaryStatValue) ⇒ Promise.<boolean>

An API that submits the user's game results.

Kind: static method of $msstart

ParamTypeDescription
primaryStatValueNumberThe 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

ParamType
switchGameDataSwitchGameData

$msstart.showDisplayAdsAsync(displayAdPlacement) ⇒ Promise.<string>

An API that invokes to show a display ad over the game

Kind: static method of $msstart

ParamTypeDescription
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

NameTypeDescription
entryPointIdstringA raw unique identifier for the entry point.
entryPointNamestringA human-friendly name for the entry point.

ShareGameData : object

Kind: global typedef
Properties

NameTypeDescription
[title]stringA title to be used in a share preview.
[text]stringText as a description to be used in a share preview.
[image]stringAn 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

NameTypeDescription
playerIdstringPlayerId 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

NameTypeDescription
[isRewardedAd]booleanA boolean value that indicates whether the request is for a rewarded ad.
[canBackfill]booleanA boolean value that indicates whether the unfulfilled ad request can be backfilled by the caller.

AdInstance : object

Kind: global typedef
Properties

NameTypeDescription
instanceIdstringA unique id for the ad instance.
showAdsCompletedAsyncPromise.<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

NameTypeDescription
idstringThe id of the game to switch to.
[payloadData]objectThe payload data we send to the game we switch to.