@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
Overrides
HTMLElement.constructor
Defined in
Properties
#root
• Private
#root: ShadowRoot
Defined in
#slotAdvantageContent
• Private
#slotAdvantageContent: HTMLSlotElement
Defined in
#slotChangeRegistered
• Private
#slotChangeRegistered: boolean
= false
Defined in
#styleSheet
• Private
#styleSheet: CSSStyleSheet
| HTMLStyleElement
Defined in
container
• container: HTMLDivElement
Implementation of
Defined in
content
• content: HTMLDivElement
Implementation of
Defined in
currentFormat
• currentFormat: null
| string
= null
Implementation of
IAdvantageWrapper.currentFormat
Defined in
messageHandler
• messageHandler: AdvantageAdSlotResponder
Defined in
simulating
• simulating: boolean
= false
Defined in
uiLayer
• uiLayer: IAdvantageUILayer
Implementation of
Defined in
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
Methods
#detectDOMChanges
▸ #detectDOMChanges(): void
Detects DOM changes and resets the wrapper if a new ad is loaded.
Returns
void
Defined in
animateClose
▸ animateClose(): void
Returns
void
Implementation of
IAdvantageWrapper.animateClose
Defined in
applyStylesToAllChildElements
▸ applyStylesToAllChildElements(styles
): void
Applies styles to all child elements of the wrapper.
Parameters
Name | Type | Description |
---|---|---|
styles | string | The CSS styles to apply. |
Returns
void
Implementation of
IAdvantageWrapper.applyStylesToAllChildElements
Defined in
changeContent
▸ changeContent(content
): void
Changes the content of the wrapper.
Parameters
Name | Type | Description |
---|---|---|
content | string | HTMLElement | The new content to be added to the wrapper. |
Returns
void
Implementation of
IAdvantageWrapper.changeContent
Defined in
close
▸ close(): void
Closes the current ad format.
Returns
void
Implementation of
Defined in
connectedCallback
▸ connectedCallback(): void
Lifecycle method called when the element is connected to the DOM.
Returns
void
Defined in
insertCSS
▸ insertCSS(CSS
): void
Inserts CSS into the shadow root of the wrapper.
Parameters
Name | Type | Description |
---|---|---|
CSS | string | The CSS to insert. |
Returns
void
Implementation of
Defined in
morphIntoFormat
▸ morphIntoFormat(format
): Promise
<void
>
Morphs the wrapper into a specific ad format.
Parameters
Name | Type | Description |
---|---|---|
format | string | The format to morph into. |
Returns
Promise
<void
>
A promise that resolves when the morphing is complete.
Implementation of
IAdvantageWrapper.morphIntoFormat
Defined in
reset
▸ reset(): void
Resets the current ad format.
Returns
void
Implementation of
Defined in
resetCSS
▸ resetCSS(): void
Resets the CSS in the shadow root of the wrapper.
Returns
void
Implementation of
Defined in
simulateFormat
▸ simulateFormat(format
): Promise
<void
>
Simulates a specific ad format.
Parameters
Name | Type | Description |
---|---|---|
format | string | The format to simulate. |
Returns
Promise
<void
>
Implementation of
IAdvantageWrapper.simulateFormat