aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/scan
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes/(app)/scan')
-rw-r--r--src/routes/(app)/scan/+page.svelte10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/routes/(app)/scan/+page.svelte b/src/routes/(app)/scan/+page.svelte
index b21a7458..655346c8 100644
--- a/src/routes/(app)/scan/+page.svelte
+++ b/src/routes/(app)/scan/+page.svelte
@@ -1,15 +1,15 @@
<script>
import { tick } from "svelte";
import Icon from "$comp/Icon.svelte";
- import QrScanner from "qr-scanner";
import { onMount, onDestroy } from "svelte";
import { back } from "$lib/utils";
import { goto } from "$app/navigation";
- import { BarcodeDetector } from "barcode-detector/ponyfill";
let scanner,
vid = $state(),
resizing;
+ let QrScanner;
+ let BarcodeDetector;
let resize = () => {
if (resizing) clearTimeout(resizing);
@@ -17,6 +17,12 @@
};
let initialize = async () => {
+ if (!QrScanner) {
+ ({ default: QrScanner } = await import("qr-scanner"));
+ }
+ if (!BarcodeDetector) {
+ ({ BarcodeDetector } = await import("barcode-detector/ponyfill"));
+ }
if (scanner) {
scanner.stop();
await new Promise((r) => setTimeout(r, 1000));