Split service component from widgets and introduce
host->plugin communication
Change-Id: I2377059dfc30c196a5b24d331fe60f0310694ba1
diff --git a/dev/demo/plugin-client.html b/dev/demo/plugin-client.html
index 2dac29b..b0b477d 100644
--- a/dev/demo/plugin-client.html
+++ b/dev/demo/plugin-client.html
@@ -32,7 +32,13 @@
});
};
};
- </script>
+
+ function pluginit (p) {
+ p.onMessage = function(msg) {
+ console.log("State changed to", msg.key, msg.value);
+ };
+ };
+ </script>
<ul>
<li><a onclick="KorAPlugin.log(333, 'Huhu!')">Send log!</a></li>
<li><a onclick="KorAPlugin.resize()">Resize</a></li>
diff --git a/dev/demo/plugin-serverdemo.js b/dev/demo/plugin-serverdemo.js
index b0b2e2a..eb91f14 100644
--- a/dev/demo/plugin-serverdemo.js
+++ b/dev/demo/plugin-serverdemo.js
@@ -13,6 +13,9 @@
//Load Plugin Server first
KorAP.Plugin = pluginClass.create();
+
+ // Add services container to head
+ document.head.appendChild(KorAP.Plugin.element());
//Register result plugin
KorAP.Plugin.register({
@@ -27,6 +30,14 @@
'action' : 'addWidget',
'template' : 'http://localhost:3003/demo/plugin-client.html',
}
+ },{
+ 'panel' : 'result',
+ 'title' : 'Glemm',
+ 'onClick' : {
+ 'action' : 'toggle',
+ 'state' : 'glemm',
+ 'template' : 'http://localhost:3003/demo/plugin-client.html',
+ }
}]
});