Fix BlueMap-Minecraft/BlueMap#346 (#6)

This commit is contained in:
Nestu 2022-10-01 12:27:23 +02:00 committed by GitHub
parent a3de6f9122
commit f53253381c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -53,6 +53,7 @@ export class MarkerManager {
this.fileUrl = fileUrl;
this.fileType = fileType;
this.events = events;
this.disposed = false;
/** @type {NodeJS.Timeout} */
this._updateInterval = null;
@ -67,6 +68,7 @@ export class MarkerManager {
if (this._updateInterval) clearTimeout(this._updateInterval);
if (ms > 0) {
let autoUpdate = () => {
if (this.disposed) return;
this.update()
.then(success => {
if (success) {
@ -153,6 +155,7 @@ export class MarkerManager {
* Stops automatic-updates and disposes all markersets and markers managed by this manager
*/
dispose() {
this.disposed = true;
this.setAutoUpdateInterval(0);
this.clear();
}