@minecraft/creator-tools
Version:
Minecraft Creator Tools command line and libraries.
36 lines (35 loc) • 1.06 kB
TypeScript
/**
* Centralized SVG loading utility.
*/
declare class SvgLoader {
/**
* Load an SVG file and return its content as a string.
* Results are cached to prevent duplicate loads.
* Failed loads return a fallback SVG and are also cached to prevent retry loops.
*
* @param path - The SVG file path (e.g., "/res/icons/myicon.svg")
* @returns Promise resolving to the SVG content string
*/
static load(path: string): Promise<string>;
/**
* Check if an SVG is already cached.
*/
static isCached(path: string): boolean;
/**
* Get cached SVG content synchronously, or null if not cached.
*/
static getCached(path: string): string | null;
/**
* Clear the SVG cache. Useful for testing or memory cleanup.
*/
static clearCache(): void;
/**
* Get the fallback SVG content.
*/
static get fallbackSvg(): string;
/**
* Check if fetch-based loading is available in this context.
*/
static get canFetch(): boolean;
}
export default SvgLoader;