@everymatrix/casino-games-category-section 0.0.259 → 0.0.262

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": "@everymatrix/casino-games-category-section",
3
- "version": "0.0.259",
3
+ "version": "0.0.262",
4
4
  "main": "dist/casino-games-category-section.js",
5
5
  "svelte": "src/index.ts",
6
6
  "scripts": {
@@ -36,5 +36,5 @@
36
36
  "publishConfig": {
37
37
  "access": "public"
38
38
  },
39
- "gitHead": "7e26e42bac250a646d98bd80910b234522350fd6"
39
+ "gitHead": "63a3c79f8f47451d7ca7f8c1dc77bb78bee91df2"
40
40
  }
@@ -65,12 +65,8 @@
65
65
  let favoriteGames:Array<Object>;
66
66
  let showFavGamesCategory:boolean = false;
67
67
  let receivedFavoriteResults:Object;
68
- let activeCategory:String;
69
- let operatorConfig:any = window.widgetConfig;
70
- let favoredGamesCollection:Array<string> = [];
71
68
  let sessionId:string = '';
72
69
  let userId:string = '';
73
- let getFavoredGamesCache:any = undefined;
74
70
  let mostPlayedScreen:Boolean = false;
75
71
  let customStylingContainer:HTMLElement;
76
72
  let validObservers:boolean = false;
@@ -105,7 +101,7 @@
105
101
  }
106
102
 
107
103
  // IntersectionObserver used for loading more games
108
- let observer = new IntersectionObserver((entries, observerRef) => {
104
+ let observer = new IntersectionObserver((entries) => {
109
105
  entries.forEach(async (entry) => {
110
106
  let gameid = entry.target.gameid; // eslint-disable-line
111
107
  let index = entry.target.elems_index; // eslint-disable-line
@@ -336,8 +332,7 @@
336
332
  case 'UpdateCategoryFavoriteGames':
337
333
  if (e.data.receivedFavoriteResults) {
338
334
  favoriteGames = e.data.receivedFavoriteResults.items;
339
-
340
- if (e.data.triggerFactor && !showFavGamesCategory) {
335
+ if (!showFavGamesCategory) {
341
336
  window.postMessage({ type: 'FavoriteUpdate' }, window.location.href);
342
337
  } else if (!lobbyView && !mostPlayedScreen) {
343
338
  window.postMessage({ type: 'CategoryUpdate', itemId: categoryid }, window.location.href);
@@ -383,7 +378,7 @@
383
378
  }
384
379
  }
385
380
  }
386
-
381
+
387
382
  // @TODO categoryId type fix
388
383
  const loadMoreGames = (categoryId:any) => {
389
384
  limit += 1;
@@ -400,15 +395,6 @@
400
395
  }
401
396
  }
402
397
 
403
- // construct favorite array used to check if game id is not already present in fav list
404
- const getGamesIds = (favoritesArray:any) => {
405
- favoredGamesCollection = [];
406
- favoritesArray.items.forEach((fav:any) => {
407
- favoredGamesCollection.push(fav.id);
408
- });
409
- return favoredGamesCollection;
410
- }
411
-
412
398
  const checkFavorite = (gameId:string) => {
413
399
  if (favoriteGames) {
414
400
  if (favoriteGames.findIndex(obj => obj.id == gameId) !== -1) {
@@ -471,18 +457,14 @@
471
457
  }
472
458
  }
473
459
 
474
- // const setupVisibility = (customStylingContainer, dataloaded) => {
475
- // if (customStylingContainer && dataloaded && hidden) {
476
- // document.addEventListener(visibilityChange, handleVisibilityChange, false);
477
- // }
478
- // }
479
-
480
460
  onMount(() => {
461
+ window.addEventListener('visibilitychange', (e) => handleVisibilityChange())
481
462
  window.addEventListener('message', messageHandler, false);
482
463
  window.postMessage({ type: 'GetFavoredGame' }, window.location.href);
483
464
 
484
465
  return () => {
485
466
  window.removeEventListener('message', messageHandler);
467
+ window.removeEventListener('visibilitychange', messageHandler);
486
468
  }
487
469
  });
488
470