-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.html
More file actions
31 lines (27 loc) · 960 Bytes
/
test.html
File metadata and controls
31 lines (27 loc) · 960 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>QR Code Testing</title>
<script type="module">
// import { makeQrCode } from "./src/QRCode.mjs";
import { makeQrCode } from "./dist/makeQrCode.min.mjs";
window.onload = () => {
const randomCanvas = () => {
const numChars = 1 + Math.floor(Math.random() * 1000);
const str = new Array(numChars).fill("x").join("");
const level = "LMQH"[(4 * Math.random()) | 0];
const { sideLength, path } = makeQrCode(level, str);
document.body.innerHTML = `
<svg width="320" height="320" viewBox="0 0 ${sideLength} ${sideLength}" xmlns="http://www.w3.org/2000/svg">
<style>path {stroke: black;}</style>
<path d="${path}" />
</svg>`;
};
// setInterval(randomCanvas, 1000);
randomCanvas();
};
</script>
</head>
<body></body>
</html>