UNPKG

@launchmenu/core

Version:

An environment for visual keyboard controlled applets

53 lines 2.34 kB
import { IDataHook } from "model-react"; import { CoreSearchExecuter } from "./CoreSearchExecuter"; import { SearchPatternFilter } from "./SearchPatternFilter"; import { IPatternMatch } from "./_types/IPatternMatch"; import { ISearchExecuterConfig } from "./_types/ISearchExecuterConfig"; /** * This class can be used to perform a 'recursive' search. * Every searchable item can return an item if it matched the search, and child searchables that should also be checked. * In addition the searchable will receive a hook when invoked, which it can use to notify the executer of changes. * When it's notified of changes, it will redo the search of the relevant item, and possibly invoke or remove changed child searchables. * * In addition any searchable can indicate it matches some 'pattern' which can be any pattern the searchable decides on. * If such a pattern is matched, all items that don't match a pattern will automatically be removed. */ export declare class SearchExecuter<Q, I> { protected executer: CoreSearchExecuter<Q, I>; protected filter: SearchPatternFilter<I>; /** * Creates a new search executor * @param config The search configuration */ constructor(config: ISearchExecuterConfig<Q, I>); /** * Sets the new query * @param query The new query to look for * @returns A promise that resolves once the query completes */ setQuery(query: Q | null): Promise<void>; /** * Retrieves the current query * @param hook The hook to subscribe to changes * @returns The current query */ getQuery(hook?: IDataHook): Q | null; /** * Retrieves whether a search is currently in progress * @param hook The hook to subscribe to changes * @returns Whether any search is in progress */ isSearching(hook?: IDataHook): boolean; /** * Retrieves the obtained patterns * @param hook The hook to subscribe to changes * @returns The patterns that were found */ getPatterns(hook?: IDataHook): IPatternMatch[]; /** * Destroys the search executer * @param keepResults Whether to preserve the items (instead of calling onRemove for all) */ destroy(keepResults?: boolean): void; } //# sourceMappingURL=SearchExecuter.d.ts.map