Implement requestMsg() for client-server-communication to receive data from the server
Change-Id: I6399679449199a3f5e75ca47348b4fd875f08142
diff --git a/dev/js/src/plugin/service.js b/dev/js/src/plugin/service.js
index a02e945..c8b42dd 100644
--- a/dev/js/src/plugin/service.js
+++ b/dev/js/src/plugin/service.js
@@ -1,5 +1,6 @@
define(function () {
"use strict";
+
return {
create : function (name, src, id) {
return Object.create(this)._init(name, src, id);
@@ -43,6 +44,17 @@
return e;
},
+ /**
+ * Send a message to the embedded service.
+ */
+ sendMsg : function (d) {
+ let iframe = this.load();
+ iframe.contentWindow.postMessage(
+ d,
+ '*'
+ ); // TODO: Fix origin
+ },
+
// onClose : function () {},
/**