0.0.3 • Published 12 months ago
element-loaded-by-id v0.0.3
elementLoadedById()
Detect when an element matching an ID is loaded into the DOM.
Synopsis
elementLoadedById(id)
.then((element) => {
// ...
});
Syntax
elementLoadedById(id)
Parameters
id
: A unique ID for the element.
Return Value
A Promise
that is:
- Already fulfilled, if the element is found already loaded into the document.
- Already rejected, if the element was not found and the DOM has already finished loading.
- Asynchronously fulfilled, when a mutation occurs that adds the element into the DOM.
- Asynchronously rejected, when the DOM has finished loading and the element has not been found.
Description
elementLoadedById()
will search the document for the element by ID.
It will continue searching until the DOM has finished loading (DOMContentLoaded
event).
See also: