Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private handleLoadStart(event: any) {
// This is to avoid increasing
// the number of loaded tiles if a tile was loading
// before subscribing to this watcher
if (!event.tile.__watchers__) {
event.tile.__watchers__ = [];
}
event.tile.__watchers__.push(this.id);
this.loading += 1;
this.status = SubjectStatus.Working;
}
.subscribe(status => {
if (status === SubjectStatus.Working) {
this.loading += 1;
} else if (status === SubjectStatus.Done) {
this.loaded += 1;
}
if (this.loaded >= this.loading) {
this.loading = this.loaded = 0;
this.status = SubjectStatus.Done;
} else if (this.loading > 0) {
this.status = SubjectStatus.Working;
}
});
.subscribe(status => {
if (status === SubjectStatus.Working) {
this.loading += 1;
} else if (status === SubjectStatus.Done) {
this.loaded += 1;
}
if (this.loaded >= this.loading) {
this.loading = this.loaded = 0;
this.status = SubjectStatus.Done;
} else if (this.loading > 0) {
this.status = SubjectStatus.Working;
}
});
private handleStatusChange(status: SubjectStatus) {
if (status === SubjectStatus.Working && this.activityId === undefined) {
this.activityId = this.activityService.register();
} else if (status === SubjectStatus.Done && this.activityId !== undefined) {
this.activityService.unregister(this.activityId);
this.activityId = undefined;
}
}
}
private handleStatusChange(status: SubjectStatus) {
if (status === SubjectStatus.Working && this.activityId === undefined) {
this.activityId = this.activityService.register();
} else if (status === SubjectStatus.Done && this.activityId !== undefined) {
this.activityService.unregister(this.activityId);
this.activityId = undefined;
}
}
}
private handleLoadStart(event: any) {
if (!event.image.__watchers__) {
event.image.__watchers__ = [];
}
event.image.__watchers__.push(this.id);
this.loading += 1;
this.status = SubjectStatus.Working;
}
.subscribe(status => {
if (status === SubjectStatus.Working) {
this.loading += 1;
} else if (status === SubjectStatus.Done) {
this.loaded += 1;
}
if (this.loaded >= this.loading) {
this.loading = this.loaded = 0;
this.status = SubjectStatus.Done;
} else if (this.loading > 0) {
this.status = SubjectStatus.Working;
}
});
.subscribe(status => {
if (status === SubjectStatus.Working) {
this.loading += 1;
} else if (status === SubjectStatus.Done) {
this.loaded += 1;
}
if (this.loaded >= this.loading) {
this.loading = this.loaded = 0;
this.status = SubjectStatus.Done;
} else if (this.loading > 0) {
this.status = SubjectStatus.Working;
}
});