This commit is contained in:
2025-09-03 14:16:18 -03:00
parent 36a004a0b0
commit b8e6d33afa
3 changed files with 23 additions and 15 deletions

View File

@@ -30,7 +30,7 @@
// 1. Obtener el manifest.json desde la ruta base detectada
const response = await fetch(`${WIDGETS_HOST}/manifest.json`);
if (!response.ok) {
throw new Error('No se pudo cargar el manifest de los widgets. (404 Not Found)');
throw new Error('No se pudo cargar el manifest. (404 Not Found)');
}
const manifest = await response.json();
@@ -53,20 +53,10 @@
// 4. Cargar el JS principal
await loadScript(jsUrl);
// 5. El addEventListener ya no es necesario aquí, el consumidor lo añade.
// Si quiere que sea totalmente automático, puede añadirlo:
window.addEventListener('load', function () {
if (window.EleccionesWidgets && typeof window.EleccionesWidgets.render === 'function') {
window.EleccionesWidgets.render();
}
});
} catch (error) {
console.error('Error al inicializar los widgets de Elecciones:', error);
}
}
initWidgets();
})();