forked from addyosmani/pubsubz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.html
33 lines (27 loc) · 759 Bytes
/
test.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
<html>
<head>
<title>Pub/Sub Test</title>
<script type="text/javascript" src="pubsubz.js"></script>
</head>
<body>
<script type="text/javascript">
var testSubscriber = function( topics , data ){
console.log( topics + ": " + data );
};
var testSubscription = pubsubz.subscribe( 'example1', testSubscriber );
pubsubz.publish( 'example1', 'hello world!' );
pubsubz.publish( 'example1', ['test','a','b','c'] );
pubsubz.publish( 'example1', [{'color':'blue'},{'text':'hello'}] );
setTimeout(function(){
pubsubz.unsubscribe( testSubscription );
}, 0);
pubsubz.publish( 'example1', 'hello again!' );
</script>
<p>
<h1>pubsubz Test</h1>
<p>
Run with Firebug or a console simulator open.
</p>
</p>
</body>
</html>