You've already forked Nitro_Render_V3
mirror of
https://github.com/duckietm/Nitro_Render_V3.git
synced 2026-06-20 07:26:18 +00:00
🆙 Updates
- Added Test Coverage - Fix Potential Memory Leaks
This commit is contained in:
@@ -15,6 +15,7 @@ export class AvatarAssetDownloadManager
|
||||
private _incompleteFigures: Map<string, AvatarAssetDownloadLibrary[]> = new Map();
|
||||
private _currentDownloads: AvatarAssetDownloadLibrary[] = [];
|
||||
private _libraryNames: string[] = [];
|
||||
private _libraryLoadedCallback: (event: AvatarRenderLibraryEvent) => void = null;
|
||||
|
||||
constructor(assets: IAssetManager, structure: AvatarStructure)
|
||||
{
|
||||
@@ -38,11 +39,27 @@ export class AvatarAssetDownloadManager
|
||||
|
||||
this.processFigureMap(responseData.libraries);
|
||||
|
||||
GetEventDispatcher().addEventListener(NitroEventType.AVATAR_ASSET_DOWNLOADED, (event: AvatarRenderLibraryEvent) => this.onLibraryLoaded(event));
|
||||
// Store callback for cleanup
|
||||
this._libraryLoadedCallback = (event: AvatarRenderLibraryEvent) => this.onLibraryLoaded(event);
|
||||
GetEventDispatcher().addEventListener(NitroEventType.AVATAR_ASSET_DOWNLOADED, this._libraryLoadedCallback);
|
||||
|
||||
await this.processMissingLibraries();
|
||||
}
|
||||
|
||||
public dispose(): void
|
||||
{
|
||||
if(this._libraryLoadedCallback)
|
||||
{
|
||||
GetEventDispatcher().removeEventListener(NitroEventType.AVATAR_ASSET_DOWNLOADED, this._libraryLoadedCallback);
|
||||
this._libraryLoadedCallback = null;
|
||||
}
|
||||
|
||||
this._figureMap.clear();
|
||||
this._figureListeners.clear();
|
||||
this._incompleteFigures.clear();
|
||||
this._currentDownloads = [];
|
||||
}
|
||||
|
||||
private processFigureMap(data: any): void
|
||||
{
|
||||
if(!data) return;
|
||||
|
||||
Reference in New Issue
Block a user