Added pipe demo and make sendMsg() puplic in plugin client library
Change-Id: I38ee2d8cec2804d0c13abf97455ccc78411df5ed
diff --git a/dev/demo/plugin-client.html b/dev/demo/plugin-client.html
index b0b477d..0250c6c 100644
--- a/dev/demo/plugin-client.html
+++ b/dev/demo/plugin-client.html
@@ -35,13 +35,27 @@
function pluginit (p) {
p.onMessage = function(msg) {
- console.log("State changed to", msg.key, msg.value);
+ switch (msg.key) {
+ // console.log("State changed to", msg.key, msg.value);
+ case 'glemm':
+ let data = {
+ 'action' : 'pipe',
+ 'service' : 'http://glemm/'
+ };
+
+ if (!msg.value) {
+ data['job'] = 'del';
+ };
+ KorAPlugin.sendMsg(data);
+ break;
+ }
};
};
</script>
<ul>
<li><a onclick="KorAPlugin.log(333, 'Huhu!')">Send log!</a></li>
<li><a onclick="KorAPlugin.resize()">Resize</a></li>
+ <li><a onclick="KorAPlugin.sendMsg({'action':'pipe','service':'Glemm'})">Add Glemm</a></li>
<li><a onclick="flood()">Flood!</a></li>
</ul>
<p style="width: 2000px">------------------------------------------------------------------------------------------------------------------------</p>
diff --git a/dev/demo/plugin-server.html b/dev/demo/plugin-server.html
index 146d2eb..98cbac0 100644
--- a/dev/demo/plugin-server.html
+++ b/dev/demo/plugin-server.html
@@ -14,8 +14,13 @@
//]]></script>
<script data-main="plugin-serverdemo.js" src="../js/lib/require.js" async="async"></script>
</head>
- <body>
+ <body>
<p>Start the demo server with <code>morbo -l 'http://*:3003' t/server/plugin.pl</code> and open <a href="http://localhost:3003/demo/plugin-server.html"><code>this website</code></a>.</p>
+
+ <header>
+ <form id="searchform" autocomplete="off" action="/kalamar"></form>
+ </header>
+
<main>
<script>
KorAP.koralQuery = {
diff --git a/dev/demo/plugin-serverdemo.js b/dev/demo/plugin-serverdemo.js
index eb91f14..096050f 100644
--- a/dev/demo/plugin-serverdemo.js
+++ b/dev/demo/plugin-serverdemo.js
@@ -8,14 +8,18 @@
-define(['app/en','match', 'panel/match', 'panel/result', 'plugin/server','lib/domReady','init'], function (lang, matchClass, matchPanelClass, resultPanelClass, pluginClass, domReady) {
+define(['app/en','match', 'panel/match', 'panel/result', 'plugin/server','pipe','lib/domReady','init'], function (lang, matchClass, matchPanelClass, resultPanelClass, pluginClass, pipeClass, domReady) {
domReady(function () {
- //Load Plugin Server first
+ // Load Plugin Server first
KorAP.Plugin = pluginClass.create();
// Add services container to head
document.head.appendChild(KorAP.Plugin.element());
+
+ // Add pipe form
+ KorAP.Pipe = pipeClass.create();
+ document.getElementById("searchform").appendChild(KorAP.Pipe.element());
//Register result plugin
KorAP.Plugin.register({