16 lines
545 B
JavaScript
Executable file
16 lines
545 B
JavaScript
Executable file
function fetchAndRender (name) {
|
|
fetch(name + '.json')
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
const mysource = document.getElementById(name + '-template').innerHTML;
|
|
const mytemplate = Handlebars.compile(mysource);
|
|
const myresult = mytemplate(data);
|
|
document.getElementById(name).innerHTML = myresult;
|
|
});
|
|
}
|
|
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
fetchAndRender('apps');
|
|
fetchAndRender('links');
|
|
fetchAndRender('providers');
|
|
});
|