-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
51 lines (47 loc) · 1.2 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Simple Process Queue</title>
<style type="text/css">
p{
background: -webkit-linear-gradient(top, #cdcdcd, #dedede);
margin: 3px;
font-size: 30px;
}
</style>
</head>
<body>
<div id="container">
</div>
<script src="queue.js"></script>
<script type="text/javascript">
window.onload = function(){
var queue = new Queue();
queue.add(function(next){
appendResult("first process");
next();
}).add(function(next){
setTimeout(function(){
appendResult("second process");
next();
},1000)
}).add(function(next){
setTimeout(function(){
appendResult("last process");
next();
},2000);
});
queue.execute(function(){
alert("all done!")
})
};
function appendResult(result){
var p = document.createElement("p"),
text = document.createTextNode(result);
p.appendChild(text);
document.getElementById("container").appendChild(p);
}
</script>
</body>
</html>