LazyModuleConfig: {
    callback?: ((module, element) => void | Promise<void>);
    dependsOn?: LazyModule | LazyModule[];
    lazy?: boolean;
    loader: string | string[] | (() => Promise<unknown>) | (() => Promise<unknown>)[];
    observerOptions?: IntersectionObserverInit;
    on?: "scroll" | "click" | "hover";
    trigger?: string | NodeListOf<HTMLElement>;
    when?: "immediate" | "interact" | "idle";
}

Type declaration

  • Optional callback?: ((module, element) => void | Promise<void>)
      • (module, element): void | Promise<void>
      • Function to execute after the module has been imported.

        Parameters

        • module: any

          The imported module

        • element: HTMLElement

          The element that triggered the module import

        Returns void | Promise<void>

  • Optional dependsOn?: LazyModule | LazyModule[]

    LazyModules dependencies, in case one or many other modules must be loaded first.

  • Optional lazy?: boolean

    Should the module be loaded when the trigger enters the viewport, or deferred to when the browser is idle.

  • loader: string | string[] | (() => Promise<unknown>) | (() => Promise<unknown>)[]

    Function that loads the module, or the es module resolve path.

    Returns

    The module that has been loaded. It can be anything: a class, a constant...

  • Optional observerOptions?: IntersectionObserverInit

    Intersection Observer options

  • Optional on?: "scroll" | "click" | "hover"

    What triggers the module loading in interact mode.

  • Optional trigger?: string | NodeListOf<HTMLElement>

    Element to watch

  • Optional when?: "immediate" | "interact" | "idle"

    What triggers the module loading.

Generated using TypeDoc