const Fuse = require("fuse.js"); var fuse; var packages = []; var Browser = { maxentries: 50, toggle: (state) => { Browser.loadfront(); if (state) { browser.scrollTo(0, 0); overlay.classList.add("shown") browser.classList.add("shown") return } else if (! state) { if (state != undefined) { overlay.classList.remove("shown") browser.classList.remove("shown") return } } browser.scrollTo(0, 0); overlay.classList.toggle("shown") browser.classList.toggle("shown") }, loadfront: async () => { Browser.loading(); if (packages.length < 1) { packages = await (await fetch("https://northstar.thunderstore.io/api/v1/package/")).json(); fuse = new Fuse(packages, { keys: ["full_name"] }) } for (let i in packages) { if (i == Browser.maxentries) {Browser.endoflist();break} new BrowserElFromObj(packages[i]); } }, loading: (string) => { if (string) { browserEntries.innerHTML = `