This repository has been archived on 2024-07-11. You can view files and clone it, but cannot push or open issues or pull requests.
nav/assets/js/data.js

17 lines
545 B
JavaScript

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');
});