InterstitialAd
import { InterstitialAd } from 'nitro-ui-admob'
A full-screen ad shown at natural transition points. Each loaded ad can be shown once, within one hour of loading. Guide: full-screen ads.
| Member | Description |
|---|---|
load(adUnitId, options?) | Loads an ad. |
expiresAt | When the ad expires. |
show() | Presents the ad once. |
| Callbacks | onAdShown, onAdDismissed, onAdFailedToShow, onAdImpression, onAdClicked, onAdPaid. |
load
static load(adUnitId: string, options?: AdmobRequestOptions): Promise<InterstitialAd>
Loads an ad, starting the SDK if needed. options is an AdmobRequestOptions. Rejects with "<code>: <message>" from the SDK.
The class has no public constructor; load is the only way to get an instance.
expiresAt
readonly expiresAt: number
When the ad expires, in milliseconds since the Unix epoch: one hour after loading.
show
show(): void
Presents the ad over the current screen. Callbacks are cleared once it is dismissed or fails to show.
Throws if this ad was already shown or has expired.
Callbacks
| Callback | Type | Called when |
|---|---|---|
onAdShown | () => void | The ad starts covering the screen. |
onAdDismissed | () => void | The user dismissed the ad. |
onAdFailedToShow | (error: AdmobError) => void | The ad could not be presented. |
onAdImpression | () => void | The SDK recorded an impression. |
onAdClicked | () => void | The SDK recorded a click. |
onAdPaid | (value: AdmobAdValue) => void | With the estimated revenue of the impression. |
All are optional properties; assign them before show(). Types: AdmobError, AdmobAdValue.