Select to view content in your preferred language

How to remove the 2d map from the dom

5255
13
Jump to solution
03-22-2017 12:27 PM
AndreaWeeg
Deactivated User

the way our UI works the map can be opened or closed depending on what the user is doing, when i remove the map from the dom it seems to still be holding on to memory, it just keeps going up and up until the browser becomes unresponsive. is there a better way to do this? this is my current code 


this.$mainDiv.find(".arc-div").remove();
this.ArcView.map = null;
this.ArcMap.removeAll();
this.ArcMap = null;
this.ArcView = null;

it seems like the tiles are still in memory they get orphaned so it never gets cleaned up. any help would be awesome! thanks! 

0 Kudos
13 Replies
BjornSvensson
Esri Regular Contributor

Jon Mullen‌ - yes, this was fixed in 4.4 (as far as we know).  Do you have a simple test app for 4.5 (or even better 4.6) that shows the issue you're seeing?

0 Kudos
JonMullen
Emerging Contributor

Sorry for taking a while to respond, but I had a mistake in my code.  Thanks.

0 Kudos
by Anonymous User
Not applicable

view.container = null is illustrated on the following example which toogle view from 2D to 3D:

Switch view from 2D to 3D | ArcGIS API for JavaScript 4.7 

But in Typescript, container property has to be an HTLMDivElement so you get an error (constructor accepts undefined though).

What would be the Typescript way then ?

Cheers !

0 Kudos
BjornSvensson
Esri Regular Contributor

null should work.

Maybe you have enabled "--strictNullChecks" in your tsconfig?
https://www.typescriptlang.org/docs/handbook/compiler-options.html