fix: await upend visit, contentType isn't array

feat/type-attributes
Tomáš Mládek 2023-05-27 23:58:05 +02:00
parent a741bad5ee
commit c3a58b21f0
1 changed files with 13 additions and 12 deletions

View File

@ -7,7 +7,7 @@
const api = new UpEndApi("http://localhost:8093");
let visitngUpEnd = false;
let visitingUpEnd = false;
let opening = false;
let openError: string | undefined;
@ -46,13 +46,12 @@
let currentUrl: string | undefined;
let contentType: string | undefined;
onMount(async () => {
browser.tabs
.executeScript(undefined, {
code: `document.querySelector('meta[name="application-name"]')?.content`,
})
.then((result) => {
visitngUpEnd = (result[0] as string | undefined) === "UpEnd";
});
visitingUpEnd =
(
await browser.tabs.executeScript(undefined, {
code: `document.querySelector('meta[name="application-name"]')?.content`,
})
)[0] === "UpEnd";
currentUrl = await getCurrentUrl();
@ -62,9 +61,11 @@
}
});
contentType = (await browser.tabs.executeScript(undefined, {
code: "document.contentType",
})) as unknown as string | undefined;
contentType = (
await browser.tabs.executeScript(undefined, {
code: "document.contentType",
})
)[0];
});
enum PRIMARY_TYPE {
@ -221,7 +222,7 @@
</script>
<main>
{#if !visitngUpEnd}
{#if !visitingUpEnd}
<div class="primary-controls">
<button
class="button"