How to destroy mapbox gl map instance

Viewed 4682

I am using "mapbox-gl": "^0.54.0". While initializing Mapboxgl instance no of web worker thread got created. please see the below image screenshot.

here is the sample code. gis-map.component.html

<div #container id="GisMapContainer">

</div>

gis-map.component.ts

import * as MapboxGl from 'mapbox-gl';

@Component({
  selector: 'gis-map',
  templateUrl: './gis-map.component.html',
  styleUrls: ['./gis-map.component.scss']
})
export class MapComponent implements OnInit, OnDestroy {

@ViewChild('container', {static: true}) mapContainer: ElementRef;

ngOnInit(){
let options={
container: this.mapContainer.nativeElement,
...
...
};
this.mapInstance = new MapboxGl.Map(options);
}

ngOnDestroy(){
this.mapInstance=null;
}

}

Now if i am destroying mapbox gl map instance on component destroy but these worker thread instance still exists.

Please give me suggestion it is possible to destroy Javascript vm web worker thread instance.

Thanks.

1 Answers
Related