-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.html
71 lines (67 loc) · 1.33 KB
/
demo.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<script src="./Highlight.js" type="text/javascript"> </script>
</head>
<body>
<style>
.comments{color:#ccc;font-style:italic}
.singlecomments{color:#ccc;}
.keyword{color:red;}
.string{color:blue;}
.builtin{color:#fabcde;}
.regexp{color:#008200}
.number {color:#909090}
</style>
<em>adsf</em>
<pre class="jscript">
//这里定义类A和类B,类A中有一个方法a,触发一个a事件
//类B想在A触发a的时候调用方法b
/*
* 多汗注释
*/
var cc="234234234a234234sdf\"asdf";/*多汗注释单行版*/
var reg = /test['"]/ig;
var ccs =23234;
function A(){};
A.prototype = {
a: function(a){
if (/undefined/.test(a)){
this.trigger('ona',{data:'data'})
}
}
};
/*
* 多汗注释
*/
//这里A类继承Bee.Emitter类
Bee.copy(A,Bee.Emitter);
function B(){};
/*
* 多汗注释
*/
B.prototype = {
b: function(data/*这里传入数据*/){
console.log('trigger B.b',data);
window.alert(11);
}
};
/*
* 多汗注释
* //adfadsf
*/
//下面是调用部分
var aa = new A;//实例化
var bb = new B;
//在aa上注册广播ona的接受接受器为bb.b方法
aa.on('ona',bb.b);
aa.on('onaa',bb.b);
</pre>
<script>
try{
Highlighter.HighlightAll();
}catch(e){alert(e);}
</script>
</body>
</html>