lido-player 0.0.2-alpha-1 → 0.0.2
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/app-col_12.cjs.entry.js +10 -32
- package/dist/cjs/app-col_12.cjs.entry.js.map +1 -1
- package/dist/cjs/lido-player.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/root/AppRoot.js +14 -92
- package/dist/collection/components/root/AppRoot.js.map +1 -1
- package/dist/components/app-root.js +10 -35
- package/dist/components/app-root.js.map +1 -1
- package/dist/esm/app-col_12.entry.js +10 -32
- package/dist/esm/app-col_12.entry.js.map +1 -1
- package/dist/esm/lido-player.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/lido-player/lido-player.esm.js +1 -1
- package/dist/lido-player/lido-player.esm.js.map +1 -1
- package/dist/lido-player/p-c3f2feae.entry.js +2 -0
- package/dist/lido-player/p-c3f2feae.entry.js.map +1 -0
- package/dist/types/components/root/AppRoot.d.ts +4 -16
- package/dist/types/components.d.ts +8 -32
- package/package.json +1 -1
- package/dist/lido-player/p-ec4f8898.entry.js +0 -2
- package/dist/lido-player/p-ec4f8898.entry.js.map +0 -1
|
@@ -496,50 +496,28 @@ AppRandom.style = AppRandomStyle0;
|
|
|
496
496
|
const AppRoot = class {
|
|
497
497
|
constructor(hostRef) {
|
|
498
498
|
index.registerInstance(this, hostRef);
|
|
499
|
-
this.xmlPath = undefined;
|
|
500
|
-
this.initialIndex = 0;
|
|
501
|
-
this.canplay = true;
|
|
502
499
|
this.xmlData = undefined;
|
|
503
500
|
}
|
|
504
501
|
/**
|
|
505
502
|
* Lifecycle method that runs before the component is loaded.
|
|
506
|
-
* It fetches the XML data from the
|
|
503
|
+
* It fetches the XML data from the assets folder and sets it to the component's state.
|
|
507
504
|
*/
|
|
508
505
|
async componentWillLoad() {
|
|
509
|
-
//
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
//
|
|
515
|
-
|
|
516
|
-
const resolvedPath = this.xmlPath.startsWith('http')
|
|
517
|
-
? this.xmlPath // Use the provided URL if it's an HTTP/HTTPS link
|
|
518
|
-
: index.getAssetPath(this.xmlPath); // Otherwise, resolve it as an asset path
|
|
519
|
-
const response = await fetch(resolvedPath);
|
|
520
|
-
if (!response.ok) {
|
|
521
|
-
throw new Error(`Failed to fetch XML data: ${response.statusText}`);
|
|
522
|
-
}
|
|
523
|
-
const data = await response.text();
|
|
524
|
-
// Store the XML data in the component's state
|
|
525
|
-
this.xmlData = data;
|
|
526
|
-
}
|
|
527
|
-
catch (error) {
|
|
528
|
-
console.error('Error fetching XML data:', error);
|
|
529
|
-
this.xmlData = null;
|
|
530
|
-
}
|
|
506
|
+
// Get the path to the XML file from the assets directory
|
|
507
|
+
const res = index.getAssetPath('./assets/xmlData.xml');
|
|
508
|
+
// Fetch the XML data asynchronously
|
|
509
|
+
const response = await fetch(res);
|
|
510
|
+
const data = await response.text();
|
|
511
|
+
// Store the XML data in the component's state
|
|
512
|
+
this.xmlData = data;
|
|
531
513
|
}
|
|
532
514
|
render() {
|
|
533
515
|
// Show a loading message until the XML data is fetched
|
|
534
|
-
if (this.xmlData
|
|
516
|
+
if (!this.xmlData) {
|
|
535
517
|
return index.h("div", null, "Loading...");
|
|
536
518
|
}
|
|
537
|
-
// Show an error message if the XML data could not be fetched
|
|
538
|
-
if (this.xmlData === null) {
|
|
539
|
-
return index.h("div", null, "Error loading XML data. Please check the path or URL.");
|
|
540
|
-
}
|
|
541
519
|
// Once the XML data is loaded, pass it to the `app-home` component
|
|
542
|
-
return index.h("app-home", { initialIndex:
|
|
520
|
+
return index.h("app-home", { initialIndex: 0, canplay: true, xmlData: this.xmlData });
|
|
543
521
|
}
|
|
544
522
|
static get assetsDirs() { return ["assets"]; }
|
|
545
523
|
};
|