AdsAPI
Defined in: services/ads.ts:68
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AdsAPI(
takeover):AdsAPI
Defined in: services/ads.ts:78
Parameters
Section titled “Parameters”takeover
Section titled “takeover”The app-wide pause/silence ceremony. Shared rather than private: a store overlay opening during an ad is one covered game, not two (see services/takeover.ts).
Returns
Section titled “Returns”AdsAPI
Accessors
Section titled “Accessors”available
Section titled “available”Get Signature
Section titled “Get Signature”get available():
boolean
Defined in: services/ads.ts:84
Whether SOME ad source exists here — the platform’s or an installed provider. False is what a menu reads to hide its “watch ad” button.
Returns
Section titled “Returns”boolean
showing
Section titled “showing”Get Signature
Section titled “Get Signature”get showing():
boolean
Defined in: services/ads.ts:89
True while an ad covers the game (the clock is paused, audio suspended).
Returns
Section titled “Returns”boolean
Methods
Section titled “Methods”preloadRewarded()
Section titled “preloadRewarded()”preloadRewarded(
adUnitId):Promise<void>
Defined in: services/ads.ts:105
Warm a rewarded unit so showRewarded has a fill ready. Best-effort:
a preload failure only means show() pays the load.
Parameters
Section titled “Parameters”adUnitId
Section titled “adUnitId”string
Returns
Section titled “Returns”Promise<void>
setProvider()
Section titled “setProvider()”setProvider(
provider):void
Defined in: services/ads.ts:98
Install (or clear with null) an AdProvider that answers INSTEAD of the platform. The editor’s play mode installs the mock; a native shell with a mediation SDK installs a real one. Clearing drops cached units.
Parameters
Section titled “Parameters”provider
Section titled “provider”AdProvider | null
Returns
Section titled “Returns”void
showInterstitial()
Section titled “showInterstitial()”showInterstitial(
adUnitId):Promise<void>
Defined in: services/ads.ts:124
Show an interstitial; resolves when it closed. Same contract as showRewarded, minus the reward.
Parameters
Section titled “Parameters”adUnitId
Section titled “adUnitId”string
Returns
Section titled “Returns”Promise<void>
showRewarded()
Section titled “showRewarded()”showRewarded(
adUnitId):Promise<PlatformRewardedAdResult>
Defined in: services/ads.ts:116
Show a rewarded video and resolve with whether the reward was earned — after the ad closed and the game is running again. Rejects when this platform has no ad source (check available first) or the host genuinely has no fill; the game state is restored in every path.
Parameters
Section titled “Parameters”adUnitId
Section titled “adUnitId”string
Returns
Section titled “Returns”Promise<PlatformRewardedAdResult>