🆙 Updates

- Added Test Coverage
- Fix Potential Memory Leaks
This commit is contained in:
DuckieTM
2026-01-31 13:21:59 +01:00
parent e263ce59bf
commit eb4fe80612
18 changed files with 1689 additions and 110 deletions
@@ -15,6 +15,7 @@ export class EffectAssetDownloadManager
private _incompleteEffects: Map<string, EffectAssetDownloadLibrary[]> = new Map();
private _currentDownloads: EffectAssetDownloadLibrary[] = [];
private _libraryNames: string[] = [];
private _libraryLoadedCallback: (event: AvatarRenderEffectLibraryEvent) => void = null;
constructor(assets: IAssetManager, structure: AvatarStructure)
{
@@ -38,11 +39,27 @@ export class EffectAssetDownloadManager
this.processEffectMap(responseData.effects);
GetEventDispatcher().addEventListener(NitroEventType.AVATAR_EFFECT_DOWNLOADED, (event: AvatarRenderEffectLibraryEvent) => this.onLibraryLoaded(event));
// Store callback for cleanup
this._libraryLoadedCallback = (event: AvatarRenderEffectLibraryEvent) => this.onLibraryLoaded(event);
GetEventDispatcher().addEventListener(NitroEventType.AVATAR_EFFECT_DOWNLOADED, this._libraryLoadedCallback);
await this.processMissingLibraries();
}
public dispose(): void
{
if(this._libraryLoadedCallback)
{
GetEventDispatcher().removeEventListener(NitroEventType.AVATAR_EFFECT_DOWNLOADED, this._libraryLoadedCallback);
this._libraryLoadedCallback = null;
}
this._effectMap.clear();
this._effectListeners.clear();
this._incompleteEffects.clear();
this._currentDownloads = [];
}
private processEffectMap(data: any): void
{
if(!data) return;