Skip to content

Commit 4e30594

Browse files
committed
1 123
1 parent 3934415 commit 4e30594

File tree

2 files changed

+128
-0
lines changed

2 files changed

+128
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<!DOCTYPE HTML>
2+
<html>
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5+
<script src="http://img.mukewang.com/down/540812440001e40e00000000.js" type="text/javascript"></script>
6+
<script src="http://img.mukewang.com/down/541f6ff70001a0a500000000.js" type="text/javascript"></script>
7+
8+
<title></title>
9+
</head>
10+
<body>
11+
12+
<script type="text/javascript">
13+
14+
15+
function Callbacks() {
16+
var list = [];
17+
var self;
18+
self = {
19+
add: function(fn) {
20+
list.push(fn)
21+
},
22+
fire: function(args) {
23+
list.forEach(function(fn) {
24+
fn(args);
25+
})
26+
}
27+
}
28+
return self;
29+
}
30+
31+
function fn1(val) {
32+
show('fn1 says:' + val);
33+
}
34+
function fn2(val) {
35+
show('fn2 says ' + val);
36+
}
37+
38+
var cbs = Callbacks();
39+
cbs.add(fn1);
40+
cbs.fire('foo');
41+
cbs.add(fn2);
42+
cbs.fire('bar')
43+
44+
45+
46+
</script>
47+
48+
</body>
49+
</html>
50+
51+
52+
53+
54+
55+
56+
57+
58+
59+
60+
61+
62+
63+
64+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<!DOCTYPE HTML>
2+
<html>
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5+
<script src="http://img.mukewang.com/down/540812440001e40e00000000.js" type="text/javascript"></script>
6+
<script src="http://img.mukewang.com/down/541f6ff70001a0a500000000.js" type="text/javascript"></script>
7+
8+
<title></title>
9+
</head>
10+
<body>
11+
12+
<script type="text/javascript">
13+
14+
15+
function Callbacks() {
16+
var list = [];
17+
var self;
18+
self = {
19+
add: function(fn) {
20+
list.push(fn)
21+
},
22+
fire: function(args) {
23+
list.forEach(function(fn) {
24+
fn(args);
25+
})
26+
}
27+
}
28+
return self;
29+
}
30+
31+
function fn1(val) {
32+
show('fn1 says:' + val);
33+
}
34+
function fn2(val) {
35+
show('fn2 says ' + val);
36+
}
37+
38+
var cbs = Callbacks();
39+
cbs.add(fn1);
40+
cbs.fire('foo');
41+
cbs.add(fn2);
42+
cbs.fire('bar')
43+
44+
45+
46+
</script>
47+
48+
</body>
49+
</html>
50+
51+
52+
53+
54+
55+
56+
57+
58+
59+
60+
61+
62+
63+
64+

0 commit comments

Comments
 (0)