RewardedInterstitialAd
Creates Rewarded Interstitial Ad and register event listeners to various events.
tip
If you are going to use Rewarded Interstitial Ad inside functional component, consider using useRewardedInterstitialAd
.
Useage Example
TODO
Methods
info
Methods listed below except createAd()
must be called from instance created by createAd()
static method.
createAd()
static createAd(unitId: string, options?: FullScreenAdOptions): RewardedInterstitialAd
Creates an ad instance.
Parameters
unitId
: Ad unitId.
options
(Optional) : Options for this ad.
Properties:
Name | Type | Default | Description |
---|---|---|---|
loadOnMounted | boolean | true | Whether your ad to load automatically on mounted. |
showOnLoaded | boolean | false | Whether your ad to show automatically on loaded. |
loadOnDismissed | boolean | false | Whether your ad to load new ad automatically on dismissed. |
requestOptions | RequestOptions | {} | Optional RequestOptions used to load the ad. |
Returns
RewardedInterstitialAd
instanceload()
load(requestOptions?: RequestOptions): Promise<void>
Loads new Ad.
Parameters
requestOptions
(Optional) : RequestOptions used to load the ad.
Returns
Promise
that waits for ad load. When error is occured while loading ad, the Promise will reject with AdError
object.
show()
show(): Promise<void>
Shows loaded Ad.
Ad must be loaded before calling this function.
Returns
Promise
that waits for ad present. When error is occurred while presenting ad, the Promise will reject with AdError
object.
addEventListener()
addEventListener(event: string, handler: (event?: any) => any): void
Adds an event handler for an ad event.
Parameters
event
: Event name. Supported events:
Event Name | Description |
---|---|
adLoaded | Fires when the ad has finished loading. |
adFailedToLoad | Fires when the ad has failed to load. The argument to the event handler is AdError object. |
adPresented | Fires when the ad is presented to user. |
adFailedToPresent | Fires when an error occurred while presenting ad. The argument to the event handler is AdError object. |
adDismissed | Fires when the ad is dismissed. |
rewarded | Fires when user earned reward. The argument to the event handler is Reward object. |
handler
: An event handler.
removeAllListeners()
removeAllListeners(): void
Removes all registered event handlers for this ad.
setRequestOptions()
setRequestOptions(requestOptions?: RequestOptions): void
Sets RequestOptions for this Ad instance.
Parameters
requestOptions
: RequestOptions used to load the ad.