-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
38 lines (28 loc) · 916 Bytes
/
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Eventjs</title>
</head>
<body>
Event is fired in 2 seconds
<script type="text/javascript" src="js/event.js"></script>
<script type="text/javascript">
var eventjs = new Event();
setTimeout( () => {
eventjs.emit('getSchwifty', 'Ohh yea, you gotta get schwifty', 'in here');
eventjs.emit('artScience', `Sometimes science is a lot more art, than science. A lot of people don't get that.`);
}, 2000);
eventjs.on( 'getSchwifty', ( data, data2 ) => {
alert( data, data2 );
});
// Never fires
eventjs.on( 'artScience', ( data ) => {
console.log('data', data);
alert( data );
});
// Removes the artScience event
eventjs.off( 'artScience' );
</script>
</body>
</html>