window.addEventListener("load", async function (ev) { let data_req = await fetch("/index.json") let data = await data_req.json() let fuse = new Fuse(data, {keys: [ "tags", "id", "title", "body" ] }) async function search(args) { try { let x = fuse.search(args) return x } catch { return null } } document.getElementById('searchbox').addEventListener("input", async function(e) { let results = document.getElementById('results') // .innerHTML = idx.search(e.target.value)) if (e.target.value == "") { results.innerHTML = "" } else { Promise.race([ search(e.target.value), new Promise((resolve, reject) => { setTimeout(() => { resolve(-1) }, 3000); }) ]).then((r) => { if (r == null) { results.innerHTML = "