Shorten the DrawLayerBuilder.prototype.cancel method a tiny bit

By replacing the early return with optional chaining, a pattern that we already use in lots of places, the code becomes a tiny bit shorter and more importantly the code coverage for this file becomes 100 percent.
This commit is contained in:
Jonas Jenwald 2026-06-06 23:37:17 +02:00
parent f12c463452
commit 0eca809589

View File

@ -68,10 +68,7 @@ class DrawLayerBuilder {
cancel() {
this._cancelled = true;
if (!this.#drawLayer) {
return;
}
this.#drawLayer.destroy();
this.#drawLayer?.destroy();
this.#drawLayer = null;
}