diff options
| author | Adam Soltys <[email protected]> | 2023-04-29 23:32:09 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-04-29 23:32:09 -0700 |
| commit | 794f56feabc86a2907005e1a43e8713b934b9303 (patch) | |
| tree | 2fa0490bd1ab400e430e3479bf801d12d97e9931 /src | |
| parent | 92c70d8350dab3de8e786bdad1c0a8f991cd8dbc (diff) | |
| download | coinos-ui-794f56feabc86a2907005e1a43e8713b934b9303.tar.gz coinos-ui-794f56feabc86a2907005e1a43e8713b934b9303.zip | |
wip
Diffstat (limited to 'src')
| -rw-r--r-- | src/routes/+page.svelte | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 3a5a54f3..510607eb 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -23,6 +23,8 @@ let faq; let about; + let log = console.log; + const howItWorksSteps = [ { image: 'hand', stepID: 'step1' }, { image: 'bolt', stepID: 'step2' }, @@ -31,6 +33,27 @@ const faqIDs = ['cost', 'compatibility', 'safety']; + let scan = async () => { + log('User clicked scan button'); + + try { + const ndef = new NDEFReader(); + await ndef.scan(); + log('> Scan started'); + + ndef.addEventListener('readingerror', () => { + log('Argh! Cannot read data from the NFC tag. Try another one?'); + }); + + ndef.addEventListener('reading', ({ message, serialNumber }) => { + log(`> Serial Number: ${serialNumber}`); + log(`> Records: (${message.records.length})`); + }); + } catch (error) { + log('Argh! ' + error); + } + }; + onMount(async () => { close(); @@ -49,6 +72,7 @@ <LandingHeader {howItWorks} {faq} {about} {user} /> <main class="space-y-40 py-20 md:py-32 lg:py-36 xl:py-40 px-5 md:px-0"> +<button on:click={scan} class="bg-black text-white mt-40 mx-auto p-8">Scan</button> <LandingHero {user} /> <LandingInfoCard image="lightning-qr" |
