-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdetect-platform.html
74 lines (58 loc) · 1.77 KB
/
detect-platform.html
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
63
64
65
66
67
68
69
70
71
72
73
74
<!doctype html>
<html lang="en">
<head>
<title>Detect Platform</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="../../src/tamarack.css" rel="stylesheet" type="text/css" />
<script src="../../src/core.js"></script>
<script src="../../src/view.js"></script>
<script src="../../src/app.js"></script>
</head>
<body>
<style>
.platformText, .deviceText {
padding: 0.5rem;
margin: 0.5rem;
border-radius: var(--tk-border-radius);
}
[web] .platformText {
background: rgba(255, 65, 65, 0.5);
}
[electron] .platformText {
background: rgba(65, 201, 255, 0.5);
}
[cordova] .platformText {
background: rgba(65, 255, 75, 0.5);
}
[desktop] .deviceText {
background: rgba(204, 204, 204, 0.5);
}
[android] .deviceText {
background: rgba(252, 255, 65, 0.5);
}
[iphone] .deviceText {
background: rgba(255, 195, 65, 0.5);
}
[ipad] .deviceText {
background: rgba(170, 65, 255, 0.5);
}
</style>
<script>
// Add needed attributes at startup
TkApp.init();
// Print the current app platform
let platformText = new TkText("h1", {
parent: TkAppContentView,
text: `App platform: ${TkApp.platform}`,
classes: ["platformText"]
});
// Print the current app device
let deviceText = new TkText("h1", {
parent: TkAppContentView,
text: `App device: ${TkApp.device}`,
classes: ["deviceText"]
});
</script>
</body>
</html>