-
Notifications
You must be signed in to change notification settings - Fork 70
/
worker.html
41 lines (35 loc) · 825 Bytes
/
worker.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
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width,minimum-scale=1.0,initial-scale=1,user-scalable=yes"/>
<style>
body {
font-family: Segoe UI;
box-sizing: border-box;
}
img {
width: 300px;
}
</style>
</head>
<body>
<pre></pre>
<script>
let worker = new Worker('worker.js')
let pre = document.querySelector('pre')
function log(string) {
pre.innerText += string + '\n'
}
log(`main script spawned worker`)
let t1 = performance.now()
worker.postMessage('../test/fixtures/IMG_20180725_163423.jpg')
worker.onmessage = e => {
let t2 = performance.now()
log(`${(t2 - t1).toFixed(1)} ms`)
log(`main script received exif from worker`)
log('-------------------------------------------------------')
log(JSON.stringify(e.data, null, 2))
}
</script>
</body>
</html>