-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.js
42 lines (39 loc) · 1.08 KB
/
test.js
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
!function(root) {
const draf = root.draf
function wasteful(stamp) {
let previous = document.querySelector('ul[hidden]')
if (previous) document.body.removeChild(previous)
let ul = document.createElement('ul')
ul.hidden = true
if (stamp) ul.dataset.frame = stamp
ul.dataset.created = performance.now()
for (let i = 0; i < 888; i++) ul.innerHTML += '<li>' + i + '</li>'
document.body.appendChild(ul)
ul.dataset.inserted = performance.now()
}
const handlers = {
janky: function() {
this.classList.toggle('zoomed')
wasteful()
},
reactive: function() {
this.classList.toggle('zoomed')
draf(wasteful)
}
}
document.addEventListener('click', function(e) {
var target = e.target
var method = target.dataset.click
if (!method) return
console.group(e.type)
console.dir(e)
if (handlers.hasOwnProperty(method)) {
console.group('render')
console.info('started')
handlers[method].call(target)
console.info('called')
console.groupEnd()
}
console.groupEnd()
})
}(this);