Fixes an error with xml output / to strict type checking
[shindig.git] / javascript / container / sample-pubsub-subscriber.xml
blobc5b4c211468011166ab472750d61c1d5a9a3df98
1 <?xml version="1.0" encoding="UTF-8"?>
2 <Module>
3 <ModulePrefs title="Sample PubSub Subscriber"
4              height="250">
5 <Require feature="pubsub"/>
6 </ModulePrefs>
7 <Content type="html">
8 <![CDATA[
9 <script>
10 function callback(sender, message) {
11   document.getElementById("output").innerHTML =
12     "message : " + gadgets.util.escapeString(message + "") + "<br/>" +
13     "sender : " + gadgets.util.escapeString(sender);
16 function subscribe() {
17   gadgets.pubsub.subscribe("random-number", callback);
20 function unsubscribe() {
21   gadgets.pubsub.unsubscribe("random-number");
22   document.getElementById("output").innerHTML = "";
25 </script>
26 <div>
27 <input type="button" value="Subscribe" onclick="subscribe()"/>
28 <input type="button" value="Unsubscribe" onclick="unsubscribe()"/>
29 </div>
30 <div id="output">
31 </div>
32 ]]>
33 </Content>
34 </Module>