mraid |
addEventListener(event, listener, opt_capture, opt_handlerScope)
Adds an observer for events dispatched by the ad environment.
The supported events are:
Arguments:
|
|||||
close()
Downgrades the state of the ad. It will also fire the
stateChange event.
|
|||||
expand(url)
Causes the ad experience to go full-screen to the size of the device,
dispatching a
stateChange event.
Arguments:
|
|||||
getExpandProperties()
⇒
Returns the expand properties.
Refer to mraid.ExpandProperty.
Returns:
A JSON Object containing expand properties.
|
|||||
getPlacementType()
⇒
Returns the mraid.PlacementType of an ad.
The supported placement types are:
Returns:
The placement type.
|
|||||
getState()
⇒
Returns the mraid.StateType of an ad.
The supported states are:
Returns:
The state.
|
|||||
getVersion()
⇒
Returns the version of MRAID specification in use. Ad developers can use this
method to confirm a basic feature set at runtime.
Returns:
The current version is "1.0".
|
|||||
isViewable()
⇒
Returns whether the ad container is currently on or off the screen.
The viewableChange event fires when the ad moves from on-screen to
off-screen and vice versa.
This is helpful when the ad is of type mraid.PlacementType.INTERSTITIAL. An interstitial loads off the screen, so wait for it to be on-screen before starting animations, timers, etc.
Returns:
Whether the ad container is currently on or off screen.
|
|||||
open(url)
Opens an external URL in a browser. On iOS the browser window remains in the
application. On Android the native browser is invoked.
Arguments:
|
|||||
removeEventListener(event, listener, opt_capture, opt_handlerScope)
Unsubscribes a specific handler method from a specific event. Event listeners
should always be removed when they are no longer useful to avoid errors.
If no listener function is provided, then all functions listening to the
event will be removed.
Arguments:
|
|||||
setExpandProperties(properties)
Sets the expand properties.
The expand properties object is intended to provide additional features to ad designers. In MRAID v.1.0, expand properties that can be set by the ad designer are limited to the width and height of the ad creative in pixels, and whether the creative is supplying its own close indicator. Refer to mraid.ExpandProperty.
Arguments:
|
|||||
useCustomClose(useCustomClose)
Sets the useCustomClose of expand properties.
This method serves as a convenience method to mraid.ExpandProperty.useCustomClose. Setting the property or calling this method both have the same effect and can be used interchangeably. If an ad sets useCustomClose via both expand properties AND this method, whichever is invoked later will override the earlier setting. They signal the SDK to stop using the default close indicator.
useCustomClose is called
and/or the property is set.
Arguments:
|
mraid.EventType
:
Events dispatched when the ad's state changes. To listen for these events
use the addEventListener method.
Constants:
|
|||||
mraid.ExpandProperty
:
The expand properties is intended to provide additional features to ad
designers. They are used in setExpandProperties
Constants:
|
|||||
mraid.PlacementType
:
Placement Type.
For efficiency, ad designers sometimes flight a single piece of creative in both banner and interstitial placements. So that the creative can be aware of its placement, and therefore potentially behave differently, each ad container has a placement type determining whether the ad is being displayed inline with content (i.e. a banner) or as an interstitial overlaid content (e.g. during a content transition). The SDK returns the value of the placement to creative so that creative can behave differently as necessary. The SDK does not determine whether a banner is an expandable (the creative does) and thus does not return a separate type for expandable.
Constants:
|
|||||
mraid.StateType
:
State of the Ad.
To access the state of an ad use the getState method.
Constants:
|