element-loaded-by-id

0.0.3 • Public • Published

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:

Package Sidebar

Install

npm i element-loaded-by-id

Weekly Downloads

1

Version

0.0.3

License

BSD-3-Clause

Unpacked Size

4.68 kB

Total Files

4

Last publish

Collaborators

  • dbezborodov