-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
37 lines (24 loc) · 869 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
34
35
36
37
<html>
<head>
<meta charset="UTF-8">
<title>Test Doc</title>
</head>
<body>
<div id="test_el">test</div>
<script src="build/build.js"></script>
<script>
function testMsg(msg1, msg2) {
console.log(msg1 + " | " + msg2);
}
//test overriding the default namespace
var mediator = require("custom-evt-manager")("JS", "someProp");
mediator.publish( "chat::message", "shaggy87", "lol dope" );
mediator.subscribe( "chat::message", testMsg, document.getElementById("test_el") );
//console.log(mediator);
mediator.publish( "chat::message", "shaggy87", "lol dope" );
//2nd mediator should be tied to the same mediator unless a different namespace is provided
var mediator2 = require("custom-evt-manager")("JS", "someProp");
mediator2.publish( "chat::message", "2nd one", "lol dope" );
</script>
</body>
</html>