Constructor
new AdSession(contextnon-null, communicationopt, nullable)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
context |
Context | that provides the required information for initialising the JS ad session. | |
communication |
Communication.<?> |
<optional> <nullable> |
Communication object that the VerificationClient will use to talk to the VerificationService. This parameter is useful for testing. If left unspecified, the correct Communication will be constructed and used. |
Methods
assertImpressionOccured()
Throws an error if an impression hasn't occured yet.
NOTE: This method is friend scoped. Therefore it should not be exported
beyond obfuscation.
assertSessionRunning()
Throws an error if the session is not running.
NOTE: This method is friend scoped. Therefore it should not be exported
beyond obfuscation.
error(errorTypenon-null, message)
Allows JS ad session clients to notify verification clients of any errors.
Possible errorType values include; “GENERIC” and “VIDEO”.
When calling this method all verification clients will be notified via the
sessionError session observer event.
Parameters:
Name | Type | Description |
---|---|---|
errorType |
ErrorType | |
message |
string |
impressionOccurred()
Handles when an impression has occured.
Sets a flag of this class so that it can remember that an impression has
occured.
NOTE: This method is friend scoped. Therefore it should not be exported
beyond obfuscation.
isSupported() → {boolean}
Returns true if OMID is available, false otherwise.
Returns:
- Type
- boolean
registerAdEvents()
Registers the existence of an AdEvent instance.
registerSessionObserver(functionToExecute)
Registers new observer for session events. The registered observer will be
notified for any session start or session finish events.
Parameters:
Name | Type | Description |
---|---|---|
functionToExecute |
function |
registerVideoEvents()
Registers the existence of an VideoEvents instance.
sendMessage(method, responseCallbacknullable, …args)
Sends a message to the OMID SessionService.
NOTE: This method is friend scoped. Therefore it should not be exported
beyond obfuscation.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
method |
string | Name of the remote method to invoke. | |
responseCallback |
function |
<nullable> |
Callback to be called when a response is received. |
args |
? |
<repeatable> |
Arguments to use when invoking the remote function. |
sendOneWayMessage(method, …args)
Sends a message to the OMID VerificationService and ignores responses.
NOTE: This method is friend scoped. Therefore it should not be exported
beyond obfuscation.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
method |
string | Name of the remote method to invoke. | |
args |
? |
<repeatable> |
Arguments to use when invoking the remote function. |
setElementBounds(elementBoundsnullable)
Set the DOM element's geometry relative to the geometry of either the
slotElement or the cross domain iframe the creative's DOM element is in.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
elementBounds |
Rectangle |
<nullable> |
Throws:
Error if the elementBounds parameter is null or undefined.