@folklore/ads 0.0.62 → 0.0.64

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/dist/cjs.js CHANGED
@@ -203,13 +203,13 @@ class AdSlot extends EventEmitter__default["default"] {
203
203
  if (this.destroyed) {
204
204
  return;
205
205
  }
206
+ this.emit('destroy', this);
206
207
  this.removeAllListeners();
207
208
  this.adSlot = null;
208
209
  this.rendered = false;
209
210
  this.displayed = false;
210
211
  this.renderEvent = null;
211
212
  this.destroyed = true;
212
- this.emit('destroy', this);
213
213
  }
214
214
  getElementId() {
215
215
  return this.elementId;
@@ -287,6 +287,7 @@ class AdsManager extends EventEmitter__default["default"] {
287
287
  // return newId;
288
288
  // }
289
289
 
290
+ static ID_PREFIX = 'div-gpt-ad-';
290
291
  static getArticleTargeting(article) {
291
292
  if (article === null) {
292
293
  return null;
@@ -360,7 +361,7 @@ class AdsManager extends EventEmitter__default["default"] {
360
361
  // const newId = `div-gpt-ad-${new Date().getTime()}-${Math.round(
361
362
  // Math.random() * (Math.random() * 1000),
362
363
  // )}-${this.index}`;
363
- const newId = `div-gpt-ad-${this.index}`;
364
+ const newId = `${AdsManager.ID_PREFIX}${this.index}`;
364
365
  this.index += 1;
365
366
  return newId;
366
367
  }
package/dist/es.js CHANGED
@@ -185,13 +185,13 @@ class AdSlot extends EventEmitter {
185
185
  if (this.destroyed) {
186
186
  return;
187
187
  }
188
+ this.emit('destroy', this);
188
189
  this.removeAllListeners();
189
190
  this.adSlot = null;
190
191
  this.rendered = false;
191
192
  this.displayed = false;
192
193
  this.renderEvent = null;
193
194
  this.destroyed = true;
194
- this.emit('destroy', this);
195
195
  }
196
196
  getElementId() {
197
197
  return this.elementId;
@@ -269,6 +269,7 @@ class AdsManager extends EventEmitter {
269
269
  // return newId;
270
270
  // }
271
271
 
272
+ static ID_PREFIX = 'div-gpt-ad-';
272
273
  static getArticleTargeting(article) {
273
274
  if (article === null) {
274
275
  return null;
@@ -342,7 +343,7 @@ class AdsManager extends EventEmitter {
342
343
  // const newId = `div-gpt-ad-${new Date().getTime()}-${Math.round(
343
344
  // Math.random() * (Math.random() * 1000),
344
345
  // )}-${this.index}`;
345
- const newId = `div-gpt-ad-${this.index}`;
346
+ const newId = `${AdsManager.ID_PREFIX}${this.index}`;
346
347
  this.index += 1;
347
348
  return newId;
348
349
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@folklore/ads",
3
- "version": "0.0.62",
3
+ "version": "0.0.64",
4
4
  "description": "Ads library",
5
5
  "keywords": [
6
6
  "javascript",
@@ -50,7 +50,7 @@
50
50
  "publishConfig": {
51
51
  "access": "public"
52
52
  },
53
- "gitHead": "db9d1c6c7ec6018ab00e67f5992bfd1544770c12",
53
+ "gitHead": "774cbc9e93dc59d16e4b503264a3fbe1cca945d3",
54
54
  "dependencies": {
55
55
  "@folklore/hooks": "^0.0.58",
56
56
  "@folklore/tracking": "^0.0.23",