destroy ads properly

This commit is contained in:
evanpelle
2026-02-03 19:52:07 -08:00
parent 286b31f403
commit d358ef79de
3 changed files with 17 additions and 0 deletions
+10
View File
@@ -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
+1
View File
@@ -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;
@@ -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();
}