MCPcopy Create free account
hub / github.com/Monogatari/Monogatari / unloadAsset

Method unloadAsset

src/actions/Unload.ts:59–79  ·  view source on GitHub ↗

* Unload a single asset using the registered loader for its category * @param category - The asset category (e.g., 'music', 'scenes', 'videos') * @param assetName - The asset identifier

(category: string, assetName: string)

Source from the content-addressed store, hash-verified

57 * @param assetName - The asset identifier
58 */
59 private unloadAsset(category: string, assetName: string): void {
60 const loaderType = Preload.getLoaderType(category);
61 if (!loaderType) {
62 console.warn(`Unload: No loader registered for category "${category}"`);
63 return;
64 }
65
66 const loaderConfig = Preload.getLoader(loaderType);
67 if (!loaderConfig) {
68 console.warn(`Unload: Loader type "${loaderType}" not found`);
69 return;
70 }
71
72 if (!loaderConfig.cache.delete) {
73 console.warn(`Unload: Loader type "${loaderType}" does not support delete operation`);
74 return;
75 }
76
77 const cacheKey = `${category}/${assetName}`;
78 loaderConfig.cache.delete(this.engine, cacheKey);
79 }
80
81 /**
82 * Unload a character sprite or all sprites for a character

Callers 2

unloadBlockMethod · 0.95
applyMethod · 0.95

Calls 2

getLoaderTypeMethod · 0.80
getLoaderMethod · 0.80

Tested by

no test coverage detected