@substrate-system/dom
    Preparing search index...

    Function waitFor

    • Wait for an element to appear in the DOM, then resolve the promise. Either a query selector or lambda function must be provided.

      Parameters

      • Optionalselector: null | string

        The CSS selector to use

      • Optionalargs: null | { timeout?: number; visible?: boolean }

        Configuration args

      • Optionallambda: () => null | Element

        An optional function that returns the element. Used if the selector is not provided.

      Returns Promise<null | HTMLElement>

      A promise that resolves to the found element.

      • Throws if neither lambda nor selector is provided.
      • Throws if the element is not found within the timeout.
      waitFor({ selector: '#my-element', visible: true, timeout: 5000 })
      .then(el => console.log('Element found:', el))
      .catch(err => console.log('Element not found:', err));