Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
unwatchLayer(layer: Layer) {
const index = this.layers.indexOf(layer);
if (index >= 0) {
const status = (layer as any).watcher.status;
if ([SubjectStatus.Working, SubjectStatus.Waiting].includes(status)) {
this.loaded += 1;
}
this.subscriptions[index].unsubscribe();
this.subscriptions.splice(index, 1);
this.layers.splice(index, 1);
}
}
}
unwatchLayer(layer: Layer) {
layer.status$.next(SubjectStatus.Done);
const index = this.layers.indexOf(layer);
if (index >= 0) {
const status = (layer as any).watcher.status;
if (
[SubjectStatus.Working, SubjectStatus.Waiting].indexOf(status) !== -1
) {
this.loaded += 1;
}
this.subscriptions[index].unsubscribe();
this.subscriptions.splice(index, 1);
this.layers.splice(index, 1);
(layer as any).watcher.unwatch();
}
}
}