@jay-js/system
Version:
A powerful and flexible TypeScript library for UI, state management, lazy loading, routing and managing draggable elements in modern web applications.
19 lines (18 loc) • 878 B
TypeScript
import type { TLazyModule } from "../types.js";
/**
* Loads a module from the cache and resets its usage counter.
*
* @param {TLazyModule} lazy - Configuration object for the lazy module
* @returns {HTMLElement} The instantiated module element
* @throws {Error} When the module is not found in cache
*/
export declare function loadFromCache(lazy: TLazyModule): HTMLElement;
/**
* Loads a module by dynamically importing it and caching the result.
* Handles both named exports and default exports automatically.
*
* @param {TLazyModule} lazy - Configuration object for the lazy module
* @param {HTMLElement} moduleSection - Element to replace with the loaded module
* @returns {Promise<HTMLElement|undefined>} The loaded module element or undefined if loading fails
*/
export declare function loadModule(lazy: TLazyModule, moduleSection: HTMLElement): Promise<any>;