todosalud-webc-form-citas 1.4.0 → 1.5.0
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 +1 -1
- package/todosalud-webc-form-citas.js +23 -7
package/package.json
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
// Loader para el Web Component
|
|
2
|
-
// Este archivo carga
|
|
2
|
+
// Este archivo carga el CSS, polyfills y el main en el orden correcto
|
|
3
3
|
(function() {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
// Cargar CSS primero
|
|
5
|
+
function loadCSS(href) {
|
|
6
|
+
return new Promise((resolve, reject) => {
|
|
7
|
+
const link = document.createElement('link');
|
|
8
|
+
link.rel = 'stylesheet';
|
|
9
|
+
link.href = href;
|
|
10
|
+
link.onload = resolve;
|
|
11
|
+
link.onerror = reject;
|
|
12
|
+
document.head.appendChild(link);
|
|
13
|
+
});
|
|
14
|
+
}
|
|
8
15
|
|
|
9
16
|
function loadScript(src) {
|
|
10
17
|
return new Promise((resolve, reject) => {
|
|
@@ -17,8 +24,17 @@
|
|
|
17
24
|
}
|
|
18
25
|
|
|
19
26
|
async function loadAll() {
|
|
20
|
-
|
|
21
|
-
|
|
27
|
+
try {
|
|
28
|
+
// 1. Cargar CSS primero
|
|
29
|
+
await loadCSS('./todosalud-webc-form-citas.css');
|
|
30
|
+
|
|
31
|
+
// 2. Luego cargar polyfills
|
|
32
|
+
await loadScript('./todosalud-webc-form-citas-polyfills.js');
|
|
33
|
+
|
|
34
|
+
// 3. Finalmente cargar main
|
|
35
|
+
await loadScript('./todosalud-webc-form-citas-main.js');
|
|
36
|
+
} catch (error) {
|
|
37
|
+
console.error('Error al cargar el Web Component:', error);
|
|
22
38
|
}
|
|
23
39
|
}
|
|
24
40
|
|