From 07611aa3a79e49e39b2a8a9e93d00df2a6a080d2 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Wed, 26 Jul 2023 19:35:47 +0200 Subject: load bangs before load finished --- frontend/main.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/frontend/main.ts b/frontend/main.ts index a5c18e7..85de64e 100644 --- a/frontend/main.ts +++ b/frontend/main.ts @@ -2,12 +2,10 @@ import { bangs, load_bangs, process_query } from "./query.ts"; import { add_page_content, status } from "./ui.ts" +load_bangs() globalThis.addEventListener("hashchange", () => process_url()) -globalThis.addEventListener("load", () => { - load_bangs() // not awaiting so we can continue loading - process_url() -}) +globalThis.addEventListener("load", () => process_url()) function process_url() { if (document.location.hash.length != 0) { @@ -21,7 +19,7 @@ function process_url() { } bangs.then(bangs => { console.log("bop"); - + if (!bangs[engine]) { status("error", "Engine does not exist") window.location.hash = "#" -- cgit v1.2.3-70-g09d2