Skip to content

@get-advantage/advantage / advantage/wrapper / AdvantageWrapper

Class: AdvantageWrapper

advantage/wrapper.AdvantageWrapper

Represents the AdvantageWrapper class, which extends the HTMLElement class and implements the IAdvantageWrapper interface. This class is responsible for creating and managing the wrapper element for Advantage ads.

Hierarchy

  • HTMLElement

    AdvantageWrapper

Implements

Constructors

constructor

new AdvantageWrapper(): AdvantageWrapper

Creates an instance of AdvantageWrapper.

Returns

AdvantageWrapper

Overrides

HTMLElement.constructor

Defined in

src/advantage/wrapper.ts:30

Properties

#root

Private #root: ShadowRoot

Defined in

src/advantage/wrapper.ts:16


#slotAdvantageContent

Private #slotAdvantageContent: HTMLSlotElement

Defined in

src/advantage/wrapper.ts:17


#slotChangeRegistered

Private #slotChangeRegistered: boolean = false

Defined in

src/advantage/wrapper.ts:18


#styleElem

Private #styleElem: HTMLStyleElement

Defined in

src/advantage/wrapper.ts:15


container

container: HTMLDivElement

Implementation of

IAdvantageWrapper.container

Defined in

src/advantage/wrapper.ts:20


content

content: HTMLDivElement

Implementation of

IAdvantageWrapper.content

Defined in

src/advantage/wrapper.ts:21


currentFormat

currentFormat: null | string = null

Implementation of

IAdvantageWrapper.currentFormat

Defined in

src/advantage/wrapper.ts:23


messageHandler

messageHandler: AdvantageAdSlotResponder

Defined in

src/advantage/wrapper.ts:24


simulating

simulating: boolean = false

Defined in

src/advantage/wrapper.ts:25


uiLayer

uiLayer: IAdvantageUILayer

Implementation of

IAdvantageWrapper.uiLayer

Defined in

src/advantage/wrapper.ts:22

Accessors

contentNodes

get contentNodes(): Node[]

Gets the content nodes assigned to the advantage-ad-slot.

Returns

Node[]

An array of content nodes.

Implementation of

IAdvantageWrapper.contentNodes

Defined in

src/advantage/wrapper.ts:111

Methods

#detectDOMChanges

#detectDOMChanges(): void

Detects DOM changes and resets the wrapper if a new ad is loaded.

Returns

void

Defined in

src/advantage/wrapper.ts:91


animateClose

animateClose(): void

Returns

void

Implementation of

IAdvantageWrapper.animateClose

Defined in

src/advantage/wrapper.ts:244


applyStylesToAllChildElements

applyStylesToAllChildElements(styles): void

Applies styles to all child elements of the wrapper.

Parameters

NameTypeDescription
stylesstringThe CSS styles to apply.

Returns

void

Implementation of

IAdvantageWrapper.applyStylesToAllChildElements

Defined in

src/advantage/wrapper.ts:292


changeContent

changeContent(content): void

Changes the content of the wrapper.

Parameters

NameTypeDescription
contentstring | HTMLElementThe new content to be added to the wrapper.

Returns

void

Implementation of

IAdvantageWrapper.changeContent

Defined in

src/advantage/wrapper.ts:196


close

close(): void

Closes the current ad format.

Returns

void

Implementation of

IAdvantageWrapper.close

Defined in

src/advantage/wrapper.ts:255


connectedCallback

connectedCallback(): void

Lifecycle method called when the element is connected to the DOM.

Returns

void

Defined in

src/advantage/wrapper.ts:323


insertCSS

insertCSS(CSS): void

Inserts CSS into the shadow root of the wrapper.

Parameters

NameTypeDescription
CSSstringThe CSS to insert.

Returns

void

Implementation of

IAdvantageWrapper.insertCSS

Defined in

src/advantage/wrapper.ts:309


morphIntoFormat

morphIntoFormat(format): Promise<void>

Morphs the wrapper into a specific ad format.

Parameters

NameTypeDescription
formatstringThe format to morph into.

Returns

Promise<void>

A promise that resolves when the morphing is complete.

Implementation of

IAdvantageWrapper.morphIntoFormat

Defined in

src/advantage/wrapper.ts:136


reset

reset(): void

Resets the current ad format.

Returns

void

Implementation of

IAdvantageWrapper.reset

Defined in

src/advantage/wrapper.ts:220


resetCSS

resetCSS(): void

Resets the CSS in the shadow root of the wrapper.

Returns

void

Implementation of

IAdvantageWrapper.resetCSS

Defined in

src/advantage/wrapper.ts:316


simulateFormat

simulateFormat(format): Promise<void>

Simulates a specific ad format.

Parameters

NameTypeDescription
formatstringThe format to simulate.

Returns

Promise<void>

Implementation of

IAdvantageWrapper.simulateFormat

Defined in

src/advantage/wrapper.ts:119