Files
edu/app/build/intermediates/assets/debug/js/components.js
T
Sebastian Molenda 0b3c8e8a02
Deploy to FTP / deploy (push) Successful in 1m47s
Build APK / build (push) Successful in 3m50s
prawie dziala
2026-05-27 13:51:51 +02:00

15 lines
414 B
JavaScript

// Komponenty HTML loader
function loadComponent(path, replaceMap = {}) {
return fetch(path)
.then(r => r.text())
.then(html => {
Object.entries(replaceMap).forEach(([key, val]) => {
html = html.replaceAll(key, val);
});
return html;
});
}
// Przykład użycia:
// loadComponent('components/header.html', {'{TITLE}': 'Tytuł', '{SUBTITLE}': 'Podtytuł'}).then(html => ...)