Function createAll

  • Create all instances of a specific component on the page

    Uses the data-module attribute to find all elements matching the specified component on the page, creating instances of the component object for each of them.

    Any component errors will be caught and logged to the console.

    Type Parameters

    Parameters

    • Component: T

      class of the component to create

    • Optionalconfig: T["defaults"]

      Config supplied to component

    • OptionalcreateAllOptions:
          | Element
          | Document
          | OnErrorCallback<T>
          | CreateAllOptions<T>

      options for createAll including scope of the document to search within and callback function if error throw by component on init

    Returns InstanceType<T>[]

    • array of instantiated components