-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.html
38 lines (36 loc) · 1.1 KB
/
example.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>Example of the most easy way to implement the broadcast</title>
<script type="text/javascript" src="broadcast.js"></script>
</head>
<body>
<h1>Results in the console</h1>
<script type="text/javascript">
broadcast.add('Client1', function () {
var nAge = 25;
var sName = 'Zane';
return {
Initialize: function () {
console.log(sName + ' Initialize');
},
GrowUp: function (args) {
nAge++;
console.log('argus:', args);
console.log('My age is ' + nAge + '!!!')
},
SaySomething: function (str, str1) {
console.log(sName + ' said: ' + str + ' ' + str1);
}
};
}());
/* Call */
broadcast.trigger('Initialize');
broadcast.trigger('GrowUp');
broadcast.trigger('SaySomething', ['yes', 'hahahahaha']);
broadcast.trigger('GrowUp', {a: 1}); // again
broadcast.trigger('NonregisterEvent'); // this call is safely ignored
</script>
</body>
</html>