Skip to content

Commit

Permalink
Commit for push to github pages
Browse files Browse the repository at this point in the history
  • Loading branch information
DMS Host committed Jun 24, 2024
0 parents commit 34196c2
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 0 deletions.
17 changes: 17 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en" style="margin:0; padding:0;">

<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, user-scalable=1.0, minimum-scale=1.0, maximum-scale=1.0">
<title>NFC reader example</title>
<script src="static/main.js" defer></script>
</head>

<body style="margin: 0; padding:0;">
<h1>NFC Reader</h1>
<div id="content"></div>
</body>

</html>
10 changes: 10 additions & 0 deletions server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from flask import Flask, render_template

app = Flask(__name__)

@app.route('/')
def index():
return render_template('index.html')

if __name__ == '__main__':
app.run(debug=True)
37 changes: 37 additions & 0 deletions static/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
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;
}
}

runApplication();
17 changes: 17 additions & 0 deletions templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en" style="margin:0; padding:0;">

<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, user-scalable=1.0, minimum-scale=1.0, maximum-scale=1.0">
<title>NFC reader example</title>
<script src="static/main.js" defer></script>
</head>

<body style="margin: 0; padding:0;">
<h1>NFC Reader</h1>
<div id="content"></div>
</body>

</html>

0 comments on commit 34196c2

Please sign in to comment.