const api = new API(API_URL); const root = document.getElementById("root"); async function init() { let library; try { library = await api.getLibrary("series"); } catch (e) { showError(e); return; } for (let group in library.videos) { root.appendChild(components.series(group, library.videos[group])); } finishedLoading(); } init();