Formats

Class that handles rendering of custom ad formats


Constructor

new Formats(main)

Constructor of Formats class

Parameters
Name Type Description
main Object

Instance of the main CpexPackage class

Methods

create(params) @public

Creates custom format - controls when and how it should be rendered

Parameters
Name Type Description
params Object

Parameters

Properties

Name Type Attributes Description
format string

Format type

elementId string

Element ID

adUnit string

Ad unit name

width number

Width

height number

Height

winningBid Object <optional>

Winning bid object

adUnitDef Object <optional>

Ad unit definition

onRender function <optional>

Callback after rendering


getInstance(params) → {Object} @internal

Returns instance of the correct format

Parameters
Name Type Description
params Object

Parameters for creating instance

Returns

Instance of specific format

Type: 
Object

isInterscroller(elementId, adUnit, width, height) → {boolean} @internal

Checks if format is interscroller

Parameters
Name Type Description
elementId string

Element ID

adUnit string

Ad unit name

width number

Width

height number

Height

Returns

True if interscroller

Type: 
boolean

isNative(width, height, mediaType) → {boolean} @internal

Checks if format is native

Parameters
Name Type Description
width number

Width

height number

Height

mediaType string

Media type name

Returns

True if native

Type: 
boolean

isOutstream(elementId, adUnit, mediaType) → {boolean} @internal

Checks if format is outstream

Parameters
Name Type Description
elementId string

Element ID

adUnit string

Ad unit name

mediaType string

Media type

Returns

True if outstream

Type: 
boolean

isResponsive(elementId, adUnit) → {boolean} @internal

Checks if format is responsive

Parameters
Name Type Description
elementId string

Element ID

adUnit string

Ad unit name

Returns

True if responsive

Type: 
boolean

isSkin(elementId, adUnit, width, height) → {boolean} @internal

Checks if format is skin

Parameters
Name Type Description
elementId string

Element ID

adUnit string

Ad unit name

width number

Width

height number

Height

Returns

True if skin

Type: 
boolean

isSlideup(elementId, adUnit) → {boolean} @internal

Checks if format is slideup

Parameters
Name Type Description
elementId string

Element ID

adUnit string

Ad unit name

Returns

True if slideup

Type: 
boolean

isVignette(elementId, adUnit) → {boolean} @internal

Checks if format is vignette

Parameters
Name Type Description
elementId string

Element ID

adUnit string

Ad unit name

Returns

True if vignette

Type: 
boolean

match(params) → {string|boolean} @internal

Determines format type based on parameters

Parameters
Name Type Description
params Object

Parameters

Properties

Name Type Description
elementId string

Element ID

adUnit string

Ad unit name

width number

Width

height number

Height

mediaType string

Media type name

Returns

Format type or false

Type: 
string | boolean