-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
DMS Host
committed
Jun 24, 2024
1 parent
34196c2
commit 583c4fd
Showing
2 changed files
with
39 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,42 @@ | ||
const ndef = new NDEFReader(); | ||
let ignoreRead = false; | ||
|
||
function read(data) { | ||
ignoreRead = true; | ||
return new Promise((resolve, reject) => { | ||
ndef.addEventListener( | ||
"reading", | ||
(event) => { | ||
console.log("reading"); | ||
}, | ||
{ once: false }, | ||
); | ||
}); | ||
} | ||
|
||
const content = document.getElementById("content"); | ||
let count = 0; | ||
|
||
async function runApplication() { | ||
while (true) { | ||
await ndef.scan(); | ||
|
||
count++; | ||
|
||
content.textContent = `Scanned items = ${count}`; | ||
const sleepTimer = new Promise((resolve) => { | ||
setTimeout(() => { | ||
resolve(); | ||
}, 500); | ||
const content = document.getElementById("read-button"); | ||
|
||
function triggerRead() { | ||
|
||
const ndef = new NDEFReader(); | ||
let ignoreRead = false; | ||
|
||
function read(data) { | ||
ignoreRead = true; | ||
return new Promise((resolve, reject) => { | ||
ndef.addEventListener( | ||
"reading", | ||
(event) => { | ||
console.log("reading"); | ||
}, | ||
{ once: false }, | ||
); | ||
}); | ||
} | ||
|
||
const content = document.getElementById("content"); | ||
let count = 0; | ||
|
||
async function runApplication() { | ||
while (true) { | ||
await ndef.scan(); | ||
|
||
count++; | ||
|
||
content.textContent = `Scanned items = ${count}`; | ||
const sleepTimer = new Promise((resolve) => { | ||
setTimeout(() => { | ||
resolve(); | ||
}, 500); | ||
}); | ||
|
||
await sleepTimer; | ||
await sleepTimer; | ||
} | ||
} | ||
} | ||
|
||
runApplication(); | ||
runApplication(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters