WaitForUtils

Wait For Utility functions

Methods

(inner) getEventFromDataLayer(eventName) → {object}

Return event from data layer
Source:
Parameters:
Name Type Description
eventName string event name property
Returns:
Type:
object
event object

(inner) waitForElement(element, callback)

Waits for an HTML element to exist in the DOM.
Source:
Parameters:
Name Type Description
element string CSS selector string for the element to wait for
callback waitForElementCallback Callback to run once element is found with, the cached HTML element as a parameter

(inner) waitForElements(element, callback)

Waits for HTML elements (using querySelectorAll) to exist in the DOM.
Source:
Parameters:
Name Type Description
element string CSS selector string for the elements to wait for
callback waitForElementCallback Callback to run once element is found with, the cached HTML DOM Element Array as a parameter

(inner) waitForElementSendAlert(testId, callback) → {waitForElement}

Returns a waitForElement function whilst setting up error handling
Source:
Parameters:
Name Type Description
testId string Test ID
callback function Function to send GA event
Returns:
Type:
waitForElement
function

(inner) waitForElementWithFallback(element, callback, fallback)

Waits for an HTML element to exist in the DOM, if it doesn't exist run fallback
Source:
Parameters:
Name Type Description
element string CSS selector string for the element to wait for
callback waitForElementCallback Callback to run once element is found with, the cached HTML element as a parameter
fallback waitForElementCallback Callback to run if element is not found

(inner) waitForLocalStorageItem(itemName, callback, intervalConfig, fallback)

Waits for an item to be present in local storage.
Source:
Parameters:
Name Type Description
itemName string Local storage item name
callback function Callback to run once element is found with, the cached local storage item as a parameter
intervalConfig object maxCalls and delay
fallback function Fallback to run when the interval times out

(inner) waitForSessionStorageItem(itemName, callback, intervalConfig, fallback)

Waits for an item to be present in session storage.
Source:
Parameters:
Name Type Description
itemName string Session storage item name
callback function Callback to run once element is found, with the cached session storage item as a parameter
intervalConfig object maxCalls and delay
fallback function Fallback to run when the interval times out

(inner) waitForWindowProperty(propertyName, callback, intervalConfig, fallback)

Waits for an item to be present in window
Source:
Parameters:
Name Type Description
propertyName string Window object property name
callback function Callback to run once property is found, with the cached window property as a parameter
intervalConfig object maxCalls and delay
fallback function Fallback to run when the interval times out

Type Definitions

waitForElementCallback(el)

This callback is displayed as a global member.
Source:
Parameters:
Name Type Description
el HTMLElement