()
| 200 | } |
| 201 | |
| 202 | override async apply(): Promise<void> { |
| 203 | if (this.isAll) { |
| 204 | // Clear all memory caches |
| 205 | this.engine.clearAllCaches(); |
| 206 | |
| 207 | // If permanent, also clear IndexedDB |
| 208 | if (this.isPermanent) { |
| 209 | await this.engine.clearAudioBufferPersistent(); |
| 210 | } |
| 211 | } else if (this.isBlock) { |
| 212 | // Unload block from memory |
| 213 | this.unloadBlock(this.blockId); |
| 214 | |
| 215 | // If permanent, also clear audio assets from IndexedDB |
| 216 | if (this.isPermanent) { |
| 217 | const blocks = Preload.blocks() as PreloadBlocks; |
| 218 | const block = blocks[this.blockId]; |
| 219 | if (block) { |
| 220 | for (const [category, assets] of Object.entries(block)) { |
| 221 | if (this.isAudioCategory(category) && Array.isArray(assets)) { |
| 222 | for (const assetName of assets) { |
| 223 | await this.unloadPersistent(category, assetName); |
| 224 | } |
| 225 | } |
| 226 | } |
| 227 | } |
| 228 | } |
| 229 | } else if (this.isCategoryOnly) { |
| 230 | // Unload entire category from memory |
| 231 | this.unloadCategoryAssets(this.category); |
| 232 | |
| 233 | if (this.isPermanent) { |
| 234 | await this.unloadPersistent(this.category); |
| 235 | } |
| 236 | } else if (this.category === 'characters') { |
| 237 | this.unloadCharacter(this.characterId, this.assetName || undefined); |
| 238 | } else if (Preload.hasLoader(this.category)) { |
| 239 | // Unload single asset from memory |
| 240 | this.unloadAsset(this.category, this.assetName); |
| 241 | |
| 242 | if (this.isPermanent) { |
| 243 | await this.unloadPersistent(this.category, this.assetName); |
| 244 | } |
| 245 | } else { |
| 246 | console.warn(`Unload: No loader registered for category "${this.category}"`); |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | override async didApply(): Promise<ActionApplyResult> { |
| 251 | return { advance: true }; |
nothing calls this directly
no test coverage detected