-
Notifications
You must be signed in to change notification settings - Fork 1
/
web-worker.html
44 lines (41 loc) · 1.21 KB
/
web-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
42
43
44
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Web Worker Event Loop</title>
<link rel="stylesheet" href="css/demo.css">
<link rel="stylesheet" href="css/common.css">
<link rel="import" href="components/event-loop.html">
<link rel="import" href="components/browser.html">
<link rel="import" href="components/queues.html">
<link rel="import" href="components/rendering-pipeline.html">
<link rel="import" href="components/queue-selector.html">
<link rel="import" href="components/queue.html">
<link rel="import" href="components/task-source.html">
<style>
body {
--background: transparent;
}
</style>
</head>
<body>
<event-loop>
<div class="sources">
<task-source type="timer"></task-source>
<task-source type="network"></task-source>
</div>
<task-queues rendering="false">
<task-queue></task-queue>
</task-queues>
</event-loop>
<script>
window.addEventListener('message', (event) => {
if (event.data === 'addTask') {
const queue = document.querySelector('task-queue');
queue.addTask();
}
});
</script>
</body>
</html>