forked from kozakdenys/qr-code-styling
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck-errors.html
More file actions
62 lines (53 loc) · 1.82 KB
/
check-errors.html
File metadata and controls
62 lines (53 loc) · 1.82 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!DOCTYPE html>
<html>
<head><title>Error Check</title></head>
<body style="padding: 40px; font-family: monospace;">
<h1>Error Check</h1>
<div id="output"></div>
<div id="qr"></div>
<script>
const output = document.getElementById('output');
const log = (msg) => {
console.log(msg);
output.innerHTML += msg + '<br>';
};
// Catch all errors
window.onerror = function(msg, url, lineNo, columnNo, error) {
log('ERROR: ' + msg);
log('Line: ' + lineNo + ', Column: ' + columnNo);
log('Stack: ' + (error ? error.stack : 'no stack'));
return false;
};
log('Loading library...');
</script>
<script src="./lib/qr-code-styling.js"></script>
<script>
log('Library loaded');
log('QRCodeStyling type: ' + typeof QRCodeStyling);
try {
// First test: Basic QR with no custom types
log('Test 1: Creating basic QR...');
const qr1 = new QRCodeStyling({
width: 200,
height: 200,
data: "TEST"
});
log('Basic QR created successfully');
qr1.append(document.getElementById("qr"));
log('Basic QR appended');
setTimeout(() => {
const svg = document.querySelector('#qr svg');
log('SVG found: ' + (svg ? 'YES' : 'NO'));
if (!svg) {
log('Checking if canvas instead...');
const canvas = document.querySelector('#qr canvas');
log('Canvas found: ' + (canvas ? 'YES' : 'NO'));
}
}, 500);
} catch(e) {
log('EXCEPTION: ' + e.message);
log('Stack: ' + e.stack);
}
</script>
</body>
</html>