UNPKG

kapcacher

Version:
96 lines (94 loc) 3.14 kB
// Generate by [js2dts@0.3.3](https://github.com/whxaxes/js2dts#readme) import { KaboomCtx } from 'kaplay/dist/kaboom'; export interface T100 { name: string; version: string; } export const HEADER: T100; declare class CacheRollout_1 { rolloutList: string[]; rolloutInterval: number; parent: CacherNamespace_1; cache: () => Cache; constructor(parent: CacherNamespace_1, rolloutList: string[], rolloutInterval?: number); rollout(cb: (name: string, nsName: string, response: Response | void, t: InstanceType<typeof CacheRollout_1>) => any): Promise<any[]>; tossBrokenCaches(rolloutList: string[]): Promise<void>; } declare class CacherNamespace_1 { namespace: string; parent: Cacher_1; cache: () => Cache; constructor(parent: Cacher_1, namespace: string); nsBuilder: any; get(name: string): Promise<Response | any>; put(name: string, response: Response): Promise<void>; makeRollout(rolloutList: string[], rolloutInterval?: number): CacheRollout_1; } declare class Cacher_1 { cacheName: string; cache: any; initialized: any; static nsBuilder(ns: string, text: string): string; constructor(cacheName: string); ensureIsInit(): void; init(): Promise<void>; createNamespace(namespace: string): CacherNamespace_1; createKaplayCacher(): any; createSpriteCacher(): any; createSoundCacher(): any; } export const Cacher: Cacher_1; export const CacherNamespace: CacherNamespace_1; export const CacheRollout: CacheRollout_1; /** * @ Kaplay Cacher * * It's required that you change the namespace, loadEntity, and fetchName (If different file-order) * in order to create your own. */ declare class KaplayCacher { loadEntity: (name: string, reader: any) => Promise<any>; fetchName: any; cache: any; parent: Cacher_1; namespace: string; CNS: CacherNamespace_1; nsBuilder: any; constructor(parent: Cacher_1, ns: string); fetchAndCache(name: string): Promise<Response>; loadCached(name: string, cachedResponse: Response): Promise<Response>; rollout(rolloutList: string[], rolloutInterval?: number): Promise<any[]>; } declare class SpriteCacher extends KaplayCacher { static namespace: any; constructor(parent: Cacher_1); loadEntity: any; } declare class SoundCacher extends KaplayCacher { static namespace: any; constructor(parent: Cacher_1); loadEntity: any; } export interface T101 { KaplayCacher: typeof KaplayCacher; SpriteCacher: typeof SpriteCacher; SoundCacher: typeof SoundCacher; Cacher: typeof Cacher_1; CacherNamespace: typeof CacherNamespace_1; CacheRollout: typeof CacheRollout_1; CacherPlugin: typeof CacherPlugin_1; name: string; version: string; } declare function CacherPlugin_1(kbg: KaboomCtx): T101; export interface T102 { Cacher: typeof Cacher_1; KaplayCacher: typeof KaplayCacher; CacherNamespace: typeof CacherNamespace_1; CacheRollout: typeof CacheRollout_1; CacherPlugin: typeof CacherPlugin_1; name: string; version: string; } export const staticPlugin: T102; export const CacherPlugin: typeof CacherPlugin_1;