4 <script src="../../lib/autobahn.min.js"></script>
5 <script src="../../cloudeebus/cloudeebus.js"></script>
6 <script type="text/javascript">
7 function evalScript() {
9 "var lambda = function() {" +
10 document.getElementById('script').value +
18 <center><h1>cloudeebus</h1></center>
20 <textarea style="width:80%" rows="32" id="script">var sampleXml= '<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"\n"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">\n<node><interface name="org.cloudeebus.Sample"><method name="Release"></method></interface></node>';
21 cloudeebus.log = function(msg) {
22 document.getElementById("log").innerHTML += msg + "\n";
25 function logCB(result) {
26 cloudeebus.log(JSON.stringify(result));
29 function errorCB(error) {
30 cloudeebus.log(error.desc ? error.desc : error);
33 function releaseCalled() {
34 cloudeebus.log("Release method called");
35 cloudeebus.SessionBus().service.returnMethod("org.cloudeebus.Sample#/org/cloudeebus/Sample#Release", true, null);
36 cloudeebus.SessionBus().service.delAgent("/org/cloudeebus/Sample", logCB, errorCB);
37 cloudeebus.SessionBus().service.remove(logCB, errorCB);
40 function serviceAdded(servName) {
41 cloudeebus.SessionBus().service.registerMethod("org.cloudeebus.Sample#/org/cloudeebus/Sample#Release",releaseCalled);
42 cloudeebus.SessionBus().service.addAgent("/org/cloudeebus/Sample", sampleXml, logCB, errorCB);
45 function connectSuccess() {
46 cloudeebus.SessionBus().addService("org.cloudeebus.Sample", serviceAdded, errorCB);
49 cloudeebus.connect("ws://localhost:9003", null, connectSuccess, errorCB);
52 <input type="button" value="run script" onclick="evalScript()"/>
53 <input type="button" value="clear log" onclick="document.getElementById('log').innerHTML='';"/>
55 <pre id="log" style="height: 20em; overflow-x: auto; overflow-y: auto; background-color: #faa;"></pre>