@everymatrix/casino-games-category-section 1.0.3 → 1.0.8

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": "1.0.3",
3
+ "version": "1.0.8",
4
4
  "main": "dist/casino-games-category-section.js",
5
5
  "svelte": "src/index.ts",
6
6
  "scripts": {
@@ -465,26 +465,6 @@
465
465
  // Nothing to do here
466
466
  }
467
467
 
468
- const setClientStyling = () => {
469
- let sheet = document.createElement('style');
470
- sheet.innerHTML = clientstyling;
471
- setTimeout(() => { customStylingContainer.appendChild(sheet);});
472
- }
473
-
474
- const setClientStylingURL = () => {
475
- let cssFile:HTMLElement = document.createElement('style');
476
-
477
- fetch(new URL(clientstylingurl))
478
- .then((res:any) => res.text())
479
- .then((data:any) => {
480
- cssFile.innerHTML = data
481
-
482
- if (customStylingContainer) {
483
- setTimeout(() => { customStylingContainer.appendChild(cssFile); }, 1);
484
- }
485
- });
486
- }
487
-
488
468
  const handleVisibilityChange = () => {
489
469
  if (!document[hidden]) {
490
470
  visibilityconnect = 'connect';
@@ -504,6 +484,25 @@
504
484
  });
505
485
  }
506
486
  }
487
+
488
+ const setClientStyling = ():void => {
489
+ let sheet = document.createElement('style');
490
+ sheet.innerHTML = clientstyling;
491
+ customStylingContainer.appendChild(sheet);
492
+ }
493
+
494
+ const setClientStylingURL = ():void => {
495
+ let url:URL = new URL(clientstylingurl);
496
+ let cssFile:HTMLElement = document.createElement('style');
497
+
498
+ fetch(url.href)
499
+ .then((res:any) => res.text())
500
+ .then((data:any) => {
501
+ cssFile.innerHTML = data
502
+
503
+ setTimeout(() => { customStylingContainer.appendChild(cssFile) }, 1);
504
+ });
505
+ }
507
506
 
508
507
  onMount(() => {
509
508
  window.addEventListener('visibilitychange', (e) => handleVisibilityChange())
@@ -518,8 +517,8 @@
518
517
 
519
518
  $: dataloaded && thumbnailContainer && setupObserver();
520
519
  $: lang && initialSetup();
521
- $: clientstyling && setClientStyling();
522
- $: clientstylingurl && setClientStylingURL();
520
+ $: clientstyling && customStylingContainer && setClientStyling();
521
+ $: clientstylingurl && customStylingContainer && setClientStylingURL();
523
522
 
524
523
  </script>
525
524
  <div class="CasinoGamesCategorySectionContainer" part="CasinoGamesCategorySectionContainer" bind:this={customStylingContainer}>