just.loadElement(tagnon-null, urlnon-null, handleropt, listeneropt) → {*}
Loads an external file if no other similar element is
found.
Parameters:
Name
Type
Default
Description
tag
element_tag
A tag name.
url
url
The url of the file.
handler
[optional]
just.loadElement~handler
appendToHead
If it's a function: it will be triggered
(without appending the element),
otherwise: the element will be appended to
head.
listener
[optional]
just.loadElement~listener
A function to trigger after
the element is appended.
Throws:
document.createElement exception or TypeError if url is missing.
Returns:
Name | Type | Default | Description |
---|---|---|---|
tag
|
element_tag | A tag name. | |
url
|
url | The url of the file. | |
handler
[optional] |
just.loadElement~handler | appendToHead | If it's a function: it will be triggered (without appending the element), otherwise: the element will be appended to head. |
listener
[optional] |
just.loadElement~listener | A function to trigger after the element is appended. |
The return of the handler.
- Type
- Any
Members
nonSrcAttributes :Object.<element_tag, just.loadElement~srcLikeAttribute>
Element-tags that are known
for not using 'src' to fetch a url.
Type:
Object.<element_tag, just.loadElement~srcLikeAttribute>
Type Definitions
handler(loadedElementnullable, url) → {*}
A custom function to append the created element.
This:
{!Element}
Parameters:
Name | Type | Description |
---|---|---|
loadedElement
[nullable] |
Element | An identical element that has been loaded previously. |
url
|
url | The given url to load. |
Returns:
Some value.
- Type
- Any
listener(eventnon-null) → {*}
A listener for the "onload" or "onerror" events.
This:
Element
Parameters:
Name | Type | Description |
---|---|---|
event
|
Event | The triggered event. |
Returns:
- Type
- Any