Common Utility functions
- Source:
Methods
(inner) injectScript(url, callback)
Injects script into the DOM and runs a callback on load
- Source:
Parameters:
Name | Type | Description |
---|---|---|
url |
string
|
url for the JS script |
callback |
function
|
Callback to run once the script is loaded |
(inner) mutationObserverOnURL(observerElement, pageUrl, options, callback)
Mutation Observer on URL
- Source:
Parameters:
Name | Type | Description |
---|---|---|
observerElement |
HTMLElement
|
HTML Node element |
pageUrl |
string
|
The page URL on which you want the callback to execute on. |
options |
object
|
observer options |
callback |
object
|
callback to run once location.href contains the above pageUrl. |
(inner) observeForExitIntent(callback)
Run callback on exist intent
- Source:
Parameters:
Name | Type | Description |
---|---|---|
callback |
function
|
callback to run on exit intent |
(inner) toPascalCase(str) → {string}
To be used when we want to convert string to pascal case
- Source:
Parameters:
Name | Type | Description |
---|---|---|
str |
string
|
"DAVID" |
Returns:
- Type:
-
string
- pascal case string - David
(inner) waitForAngularRootElements() → {Promise}
Wait for Angular elements to be loaded
- Source:
Returns:
- Type:
-
Promise
- Resolve when angular root elements are loaded