diff --git a/src/client/GutterAds.ts b/src/client/GutterAds.ts index 91cc08e30..88b498a02 100644 --- a/src/client/GutterAds.ts +++ b/src/client/GutterAds.ts @@ -50,6 +50,16 @@ export class GutterAds extends LitElement { }); } + public close(): void { + try { + window.ramp.destroyUnits(this.leftAdType); + window.ramp.destroyUnits(this.rightAdType); + console.log("successfully destroyed gutter ads"); + } catch (e) { + console.error("error destroying gutter ads", e); + } + } + private loadAds(): void { console.log("loading ramp ads"); // Ensure the container elements exist before loading ads diff --git a/src/client/Main.ts b/src/client/Main.ts index 24a041ac5..9189efebf 100644 --- a/src/client/Main.ts +++ b/src/client/Main.ts @@ -813,6 +813,7 @@ class Client { "token-login", "matchmaking-modal", "lang-selector", + "gutter-ads", ].forEach((tag) => { const modal = document.querySelector(tag) as HTMLElement & { close?: () => void; diff --git a/src/client/graphics/layers/InGameHeaderAd.ts b/src/client/graphics/layers/InGameHeaderAd.ts index fb956b267..6e790af0a 100644 --- a/src/client/graphics/layers/InGameHeaderAd.ts +++ b/src/client/graphics/layers/InGameHeaderAd.ts @@ -71,6 +71,12 @@ export class InGameHeaderAd extends LitElement implements Layer { private hideHeaderAd(): void { this.shouldShow = false; this.adLoaded = false; + try { + window.ramp.destroyUnits(HEADER_AD_TYPE); + console.log("successfully destroyed in game header ad"); + } catch (e) { + console.error("error destroying in game header ad", e); + } this.requestUpdate(); }