mirror of
https://github.com/NebulaServices/Nebula.git
synced 2025-05-13 12:00:01 -04:00
We don't need libcurl on EVERY page
This commit is contained in:
parent
88b24b55e6
commit
10992aad3c
1 changed files with 8 additions and 4 deletions
|
@ -46,6 +46,7 @@ const t = useTranslations(lang);
|
|||
import { search } from "@utils/search.ts"; //../../utils/search.ts
|
||||
//@ts-expect-error No types, expected. See: https://github.com/ading2210/libcurl.js for docs on how to use.
|
||||
import { libcurl } from "libcurl.js-new/bundled";
|
||||
let libcurlClient: boolean = false;
|
||||
type Suggestion = {
|
||||
phrase: string
|
||||
}
|
||||
|
@ -71,9 +72,6 @@ const t = useTranslations(lang);
|
|||
const input = document.getElementById("nebula-input") as HTMLInputElement;
|
||||
const iframe = document.getElementById("neb-iframe") as HTMLIFrameElement;
|
||||
const omnibox = document.getElementById("omnibox") as HTMLDivElement;
|
||||
await libcurl.load_wasm();
|
||||
libcurl.set_websocket(WispServerURLS.default);
|
||||
console.debug("Libucurl ready?", libcurl.ready);
|
||||
input?.addEventListener("keypress", function (event: any) {
|
||||
if (event.key === "Enter") {
|
||||
initSw().then(() => {
|
||||
|
@ -88,6 +86,12 @@ const t = useTranslations(lang);
|
|||
}
|
||||
})
|
||||
input?.addEventListener("input", async function() {
|
||||
if (!libcurlClient) {
|
||||
await libcurl.load_wasm();
|
||||
libcurl.set_websocket(WispServerURLS.default);
|
||||
console.debug("Libucurl ready?", libcurl.ready);
|
||||
libcurlClient = true;
|
||||
}
|
||||
const value = input?.value;
|
||||
input.classList.remove("rounded-b-2xl");
|
||||
omnibox.classList.remove("hidden");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue