UNPKG

lit-securities-utility

Version:

A utility package for securities applications

40 lines (39 loc) 1.39 kB
/** * Manages search logic using Web Workers and Security Master initialization. * * It waits for the `SECURITY_MASTER_INITIALIZED` event and initializes workers for each search chunk. * It then delegates search operations to the workers and collects their results. */ declare class SearchManager { STATE: 'INIT' | 'READY'; WORKER: Worker[]; constructor(); /** * Initializes the search manager: * - Changes state to READY * - Fetches chunked index data * - Spawns a Web Worker per chunk * - Sends the chunk data to each worker */ initialize: () => void; /** * Initiates a search by sending the search string to all workers. * Waits for all responses, then flattens and resolves the final search result. * * @param searchString - The term to search for * @returns Promise resolving to an array of matched search results */ search: (searchString: string) => Promise<unknown>; /** * Combines and enriches raw results from all workers into a single result array. * * @param workerResults - Raw result arrays from workers * @returns Flattened and enriched result array */ _flattenResult: (workerResults: any[]) => any[]; } /** * Singleton instance of SearchManager exported for use across app. */ declare const searchManager: SearchManager; export { searchManager };