@betarena/ad-engine 0.0.71 → 0.0.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betarena/ad-engine",
3
- "version": "0.0.71",
3
+ "version": "0.0.72",
4
4
  "private": false,
5
5
  "description": "Betarena ad-engine widget",
6
6
  "keywords": [
@@ -38,7 +38,7 @@
38
38
  // │ 5. type(s) imports(s) │
39
39
  // ╰────────────────────────────────────────────────────────────────────────╯
40
40
 
41
- import { onMount } from 'svelte';
41
+ import { onDestroy, onMount } from 'svelte';
42
42
  import { fly } from 'svelte/transition';
43
43
 
44
44
  import { ServiceAdEngine } from '@betarena/scores-lib/dist/classes/_service.adengine.js';
@@ -49,7 +49,7 @@
49
49
 
50
50
  import iconClose from './assets/icon-close.svg';
51
51
  import iconArrow from './assets/icon-external-link.svg';
52
-
52
+ import { logger } from './utils/debug.js';
53
53
 
54
54
  import type { AdsCreativeMain } from '@betarena/scores-lib/types/v8/_HASURA-0.js';
55
55
 
@@ -125,6 +125,14 @@
125
125
  // │ as soon as 'this' .svelte file is ran. │
126
126
  // ╰────────────────────────────────────────────────────────────────────────╯
127
127
 
128
+ let
129
+ /**
130
+ * @description
131
+ * 📝 timeout for advert show
132
+ */
133
+ intTimeoutForAdvertShow: ReturnType<typeof setTimeout> | null = null
134
+ ;
135
+
128
136
  onMount
129
137
  (
130
138
  () =>
@@ -134,7 +142,7 @@
134
142
  // ╭─────
135
143
  // │ NOTE: |:| Advert timeour start
136
144
  // ╰─────
137
- setTimeout
145
+ intTimeoutForAdvertShow = setTimeout
138
146
  (
139
147
  () =>
140
148
  {
@@ -175,6 +183,33 @@
175
183
  }
176
184
  );
177
185
 
186
+ onDestroy
187
+ (
188
+ () =>
189
+ {
190
+ // [🐞]
191
+ logger
192
+ (
193
+ [
194
+ 'Betarena Ad-Engine ⏰ onMount ⏰ cleanup (x2)'
195
+ ],
196
+ );
197
+
198
+ if (intTimeoutForAdvertShow)
199
+ clearTimeout(intTimeoutForAdvertShow);
200
+ ;
201
+
202
+ document.getElementById(CNAME)?.remove();
203
+
204
+ document.body.classList.remove
205
+ (
206
+ 'disable-scroll'
207
+ );
208
+
209
+ return;
210
+ }
211
+ );
212
+
178
213
  // #endregion ➤ 🔄 LIFECYCLE [SVELTE]
179
214
 
180
215
  </script>