whenDefined

The whenDefined() method of the resolves when the named element is defined.

MDN Reference