aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/funder
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-07-10 12:36:50 -0700
committerAdam Soltys <[email protected]>2025-07-10 12:36:50 -0700
commit5b458624745c7ea80d1e63c9a6ef77075763ff5f (patch)
tree462e71c86d97ed78eaf5324697350feab8af6a33 /src/routes/(app)/funder
parentee8e20ce1dbcc0476ec698dd8c9d0ff99e260db7 (diff)
downloadcoinos-ui-5b458624745c7ea80d1e63c9a6ef77075763ff5f.tar.gz
coinos-ui-5b458624745c7ea80d1e63c9a6ef77075763ff5f.zip
user onboarding
Diffstat (limited to 'src/routes/(app)/funder')
-rw-r--r--src/routes/(app)/funder/+page.svelte55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/routes/(app)/funder/+page.svelte b/src/routes/(app)/funder/+page.svelte
new file mode 100644
index 00000000..e6549360
--- /dev/null
+++ b/src/routes/(app)/funder/+page.svelte
@@ -0,0 +1,55 @@
+<script lang="ts">
+ import { onMount } from 'svelte';
+let here = false;
+ let ready = false;
+ let success = false;
+ let controller: AbortController | null = null;
+ let NfcWriter: any;
+
+ async function write() {
+ NfcWriter = window.Capacitor?.Plugins?.NfcWriter;
+ ready = true;
+ console.log(window.Capacitor);
+ if (!NfcWriter) return;
+ here = true;
+
+ try {
+ await NfcWriter.enableExclusiveNfcMode();
+
+ if (controller) controller.abort();
+ controller = new AbortController();
+
+ ready = true;
+
+ const ndef = new NDEFReader();
+ await ndef.write(
+ {
+ records: [
+ {
+ recordType: 'url',
+ data: 'https://coinos.io',
+ },
+ ],
+ },
+ { signal: controller.signal }
+ );
+
+ success = true;
+ } catch (err) {
+ if (err.name === 'AbortError') {
+ console.warn('Previous write aborted');
+ } else {
+ console.error('Write failed', err);
+ alert('❌ Write failed: ' + err.message);
+ }
+ } finally {
+ await NfcWriter.disableExclusiveNfcMode();
+ }
+ }
+</script>
+
+HI
+<button class="p-4 btn" on:click={write}>write</button>
+{#if here}HERE{/if}
+{#if ready}go{/if}
+{#if success}done{/if}