@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.
37 lines (36 loc) • 1.48 kB
TypeScript
import type { ConfigChangeCallback, TImportedModule, TLazyOptions } from "../types.js";
/**
* Global configuration options for the lazy loading system.
* Default values:
* - gcThreshold: 300000 (5 minutes)
* - gcInterval: 60000 (1 minute)
*/
export declare const lazyOptions: TLazyOptions;
/**
* Global cache for storing imported modules and their metadata.
* The key is the module name and the value contains:
* - module: The actual module function/class
* - lastUsed: Counter for tracking module usage
* - collect: Whether the module can be garbage collected
*/
export declare const moduleCache: Map<string, TImportedModule>;
/**
* Registers a callback to be called when lazy loading configuration changes.
*
* @param {ConfigChangeCallback} callback - Function to be called with new options
*/
export declare function addConfigChangeListener(callback: ConfigChangeCallback): void;
/**
* Removes a previously registered configuration change callback.
*
* @param {ConfigChangeCallback} callback - The callback to remove
*/
export declare function removeConfigChangeListener(callback: ConfigChangeCallback): void;
/**
* Updates the lazy loading configuration options.
* Undefined values are removed from the update to preserve existing values.
* Triggers all registered configuration change listeners.
*
* @param {Partial<TLazyOptions>} options - Partial configuration object
*/
export declare function setLazyOptions(options: Partial<TLazyOptions>): void;