-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
35 lines (35 loc) · 1.25 KB
/
index.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
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>diyReact</title>
</head>
<body>
<div id="opr">
<label><input name="demo" type="radio" value="stage0-base"/>基本</label>
<label><input name="demo" type="radio" value="stage1-composite"/>复杂组件</label>
<label><input name="demo" type="radio" value="stage2-update"/>更新组件</label><br/>
<label><input name="demo" type="radio" value="stage3-domdiff"/>domDiff</label>
<label><input name="demo" type="radio" value="stage4-transaction"/>transaction</label>
<label><input name="demo" type="radio" value="stage5"/>stage5</label>
</div>
<div id="root"></div>
<script>
const myWorker = new Worker('./tools/worker.js');
const root = document.getElementById('root');
document.getElementById('opr').addEventListener('click',function(e){
const {name , value} = e.target;
if(name === 'demo'){
root.innerHTML = '刷新ing';
myWorker.postMessage([value]);
myWorker.onmessage = function(e) {
root.innerHTML = '';
eval(e.data);
}
}
})
</script>
</body>
</html>