Common functions and helpers.
Methods
(static) asyncGet(url, headers) → {Promise}
Wrapper around fetch api to return the URL fetched content as text
Parameters:
Name | Type | Description |
---|---|---|
url |
string
|
URL to fetch its content. |
headers |
Object
|
Headers to add to the fetch request. |
Returns:
- Type:
-
Promise
Fetch promise with the response text as argument on success
(static) asyncGet(url, headers) → {Promise}
Wrapper around fetch api to return the URL fetched content as text
Parameters:
Name | Type | Description |
---|---|---|
url |
string
|
URL to fetch its content. |
headers |
Object
|
Headers to add to the fetch request. |
Returns:
- Type:
-
Promise
Fetch promise with the response text as argument on success
(static) createNode(tag, properties, styles, dataset) → {HTMLElement}
Create new HTML element.
Parameters:
Name | Type | Description |
---|---|---|
tag |
string
|
Element tag name |
properties |
Object
|
Mapping of element properties and its values |
styles |
Object
|
Mapping of element styles to apply |
dataset |
Object
|
Mapping of element data set. |
Returns:
- Type:
-
HTMLElement
The created element.
(static) createNode(tag, properties, styles, dataset) → {HTMLElement}
Create new HTML element.
Parameters:
Name | Type | Description |
---|---|---|
tag |
string
|
Element tag name |
properties |
Object
|
Mapping of element properties and its values |
styles |
Object
|
Mapping of element styles to apply |
dataset |
Object
|
Mapping of element data set. |
Returns:
- Type:
-
HTMLElement
The created element.
(static) rmChildren(parent)
Remove HTML element all child elements
Parameters:
Name | Type | Description |
---|---|---|
parent |
HTMLElement
|
HTML element to remove it children |
(static) rmChildren(parent)
Remove HTML element all child elements
Parameters:
Name | Type | Description |
---|---|---|
parent |
HTMLElement
|
HTML element to remove it children |
(static) setClipboard(text)
Send setClipboard message to thebackground script with text to add to clipboard.
Parameters:
Name | Type | Description |
---|---|---|
text |
string
|
Text to add to clipboard. |