EmbeddedSelectorManager

EmbeddedSelectorManager

Interface for managing CSS selectors to place embedded views in.

Methods

remove(selector) → {void}

Removes the embedded ID and all embedded views associated with a selector.

If there are no more selectors being managed, the DOM observer will be stopped.

Parameters:
Name Type Description
selector string

the view style ID created in the Airship dashboard

Returns:
Type:
void

removeAll() → {void}

Removes all selectors and any embedded views associated with them.

If a DOM observer is running, it will be stopped.

Returns:
Type:
void

set(selector, embeddedId) → {void}

Sets the embedded ID for the provided selector.

If this is the first CSS selector, a DOM observer will be started to observe changes and create an embedded view whenever an element matches the selector.

If the selector already had an embedded ID, the previous value will be overwritten and any existing embedded views for that embedded ID will be destroyed.

Parameters:
Name Type Description
selector string

the CSS selector

embeddedId string

the view style ID created in the Airship dashboard

Returns:
Type:
void

setAll(selectorToEmbeddedIdMap) → {void}

Replaces the previous selector mapping with the provided mapping.

A DOM observer will be started to observe changes and create an embedded view whenever an element matches the selector.

Parameters:
Name Type Description
selectorToEmbeddedIdMap Record.<string, string>

a mapping where keys are CSS selectors and values are embedded IDs

Returns:
Type:
void