const sprintf = (...[string, ...args]) => { return string.replace(/{(\d+)}/g, (match, number) => args[number] ?? match); } const getJSON = async url => { const resp = await fetch(url) const json = await resp.json() return json; } const createPopup = async id => { const asics = getJSON('/api/asictypes') asicoptions = '' asics.forEach(elem => { asicoptions += sprintf('', elem['key'], elem['value']) }) document.querySelector('body').innerHTML += sprintf(popup, id, asicoptions, 'content') } const deletePopup = id => { document.querySelector('#popup-' + id).remove() } const update = () => { // console.log(getJSON('/api/')) } const datafn = async () => { // return await getJSON('/api/webinit') } const data = datafn() console.log(data) const cols = 40 const rows = 40 const css = ` ` const header = '