forked from WebReflection/hyperHTML
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdbmonster-bench.html
More file actions
122 lines (114 loc) · 4.28 KB
/
Copy pathdbmonster-bench.html
File metadata and controls
122 lines (114 loc) · 4.28 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="dbmonster.css">
<script src="https://unpkg.com/perf-monitor@0.3.0/dist/umd/perf-monitor.js"></script>
<script src="../min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
var
// retrieve a wire or create one, based on lists of data
// necessary if you have JSON data to deal with
// since weak reference won't bring in any benefit
render = (arr, i) => arr[i] || (arr[i] = hyperHTML.wire()),
// list of all known renders
renderTABLE = hyperHTML.bind(document.querySelector('#app')),
TRs = [],
mutations = 100
;
function updateTable(dbs) {
renderTABLE`
<table class="table table-striped latest-data">
<tbody>${dbs.map((db, i) => render(TRs, i)`
<tr key="${db.dbname}">
<td class="dbname">
${db.dbname}
</td>
<td class="query-count">
<span class="${db.lastSample.countClassName}">
${db.lastSample.nbQueries}
</span>
</td>
<td class="${db.lastSample.topFiveQueries[0].elapsedClassName}">
<span class="foo">
${db.lastSample.topFiveQueries[0].formatElapsed}
</span>
<div class="popover left">
<div class="popover-content">
${db.lastSample.topFiveQueries[0].query}
</div>
<div class="arrow"></div>
</div>
</td>
<td class="${db.lastSample.topFiveQueries[1].elapsedClassName}">
<span class="foo">
${db.lastSample.topFiveQueries[1].formatElapsed}
</span>
<div class="popover left">
<div class="popover-content">
${db.lastSample.topFiveQueries[1].query}
</div>
<div class="arrow"></div>
</div>
</td>
<td class="${db.lastSample.topFiveQueries[2].elapsedClassName}">
<span class="foo">
${db.lastSample.topFiveQueries[2].formatElapsed}
</span>
<div class="popover left">
<div class="popover-content">
${db.lastSample.topFiveQueries[2].query}
</div>
<div class="arrow"></div>
</div>
</td>
<td class="${db.lastSample.topFiveQueries[3].elapsedClassName}">
<span class="foo">
${db.lastSample.topFiveQueries[3].formatElapsed}
</span>
<div class="popover left">
<div class="popover-content">
${db.lastSample.topFiveQueries[3].query}
</div>
<div class="arrow"></div>
</div>
</td>
<td class="${db.lastSample.topFiveQueries[4].elapsedClassName}">
<span class="foo">
${db.lastSample.topFiveQueries[4].formatElapsed}
</span>
<div class="popover left">
<div class="popover-content">
${db.lastSample.topFiveQueries[4].query}
</div>
<div class="arrow"></div>
</div>
</td>
</tr>`
)}</tbody>
</table>`;
}
updateTable(ENV.generateData().toArray());
perfMonitor.startFPSMonitor();
perfMonitor.startMemMonitor();
perfMonitor.initProfiler('view update');
function update() {
requestAnimationFrame(update);
perfMonitor.startProfile('view update');
updateTable(ENV.generateData().toArray());
perfMonitor.endProfile('view update');
}
requestAnimationFrame(update);
}, {once: true});
</script>
</head>
<body>
<div id="app"></div>
<div id="link">
You're looking at hyperHTML<br>
version of <a href="https://dbmonster.firebaseapp.com/">DBMonster</a>.
</div>
</body>
<script src="./dbmonster.js"></script>
</html>