SheetXL - v1.0.2
    Preparing search index...

    Function defineLazyModule

    • Defines a module that is loaded on first use.

      Type Parameters

      • T
      • M = T

      Parameters

      • key: string

        Unique key, for example 'studio:sortDialog'. Defining a key again replaces the module defined with it.

      • loader: () => Promise<T>

        Imports the module, typically () => import('./SortDialog'). It must resolve to the module itself, with any export picked by options.select: after a failed fetch, the module is imported again directly from the URL the browser reported.

      • Optionaloptions: LazyModuleOptions<T, M>

        Selection, prefetch, and retry options.

      Returns LazyModule<M>

      Browsers remember a failed module fetch until the page reloads. When the browser's error names the module's URL, later attempts import that URL again under a new query string, so the module loads once the network is back. Where the error does not name it (Safari), a failed module loads again only after a reload.

      const SortDialog = defineLazyModule('studio:sortDialog', () => import('./SortDialog'));
      const { default: Dialog } = await SortDialog.load();

      const Chart = defineLazyModule('sdk:chart', () => import('./Chart'), { select: (m) => m.Chart });