import type { OrArray } from '@jsmanifest/typefest'; import type Viewport from '../Viewport'; import type { ICache, IPage, NuiComponent } from '../types'; import NuiPage from '../Page'; import * as c from '../constants'; export interface PageCacheHooks { [c.cache.page.hooks.PAGE_CREATED](args: { component?: NuiComponent.Instance; page: NuiPage; }): void; [c.cache.page.hooks.PAGE_REMOVED](page: NuiPage): void; } export interface State { created: Map; removed: Map; } export interface StatePageObject { startPage: string; endPage: string; } declare class PageCache implements ICache { #private; static _inst: PageCache; [Symbol.iterator](): { next(): { value: [string | number, { page: NuiPage; }] | undefined; done: boolean; }; }; constructor(); get length(): number; get hooks(): { PAGE_CREATED: PageCacheHooks["PAGE_CREATED"][]; PAGE_REMOVED: PageCacheHooks["PAGE_REMOVED"][]; }; get state(): State; clear(): this; create(args?: { name?: string; component?: NuiComponent.Instance; id?: string; onChange?: { id?: string; fn?: (prev: string, next: string) => void; }; viewport?: Viewport; }): NuiPage; get(id: IPage['id']): { page: NuiPage; }; get(id?: never): [{ page: NuiPage; }]; has(id: IPage['id']): boolean; forEach(fn: (page: { page: NuiPage; }, index: IPage['id'], collection: { page: NuiPage; }[]) => void): void; on(evt: Evt, fn: PageCacheHooks[Evt]): this; remove(page: NuiPage): this; toJSON(): { ids: OrArray[]; length: number; pageNames: string[]; }; } export default PageCache;