import { Naja, Options } from '../Naja'; import { HistoryState } from './HistoryHandler'; import { SnippetHandler } from './SnippetHandler'; import { TypedEventListener } from '../utils'; declare module '../Naja' { interface Options { snippetCache?: boolean | SnippetCacheStorageType; } } declare module './HistoryHandler' { interface HistoryState { snippets?: { readonly storage: SnippetCacheStorageType; readonly key: SnippetCacheKey; }; } } export declare class SnippetCache extends EventTarget { private readonly naja; private initialized; private readonly storages; private currentSnippets; private static parser; constructor(naja: Naja); private resolveStorage; private static shouldCacheSnippet; private initializeIndex; private updateIndex; private configureCache; private buildHistoryState; private restoreHistoryState; addEventListener: (type: K, listener: TypedEventListener, options?: boolean | AddEventListenerOptions) => void; removeEventListener: (type: K, listener: TypedEventListener, options?: boolean | AddEventListenerOptions) => void; } export type StoreEvent = CustomEvent<{ snippets: CachedSnippets; state: HistoryState; options: Options; }>; export type FetchEvent = CustomEvent<{ state: HistoryState; options: Options; }>; export type RestoreEvent = CustomEvent<{ snippets: CachedSnippets; state: HistoryState; options: Options; }>; interface SnippetCacheEventMap { store: StoreEvent; fetch: FetchEvent; restore: RestoreEvent; } type CachedSnippets = Record; type SnippetCacheKey = CachedSnippets | string | null; type SnippetCacheStorageType = 'off' | 'history' | 'session'; export {};