SVGHMI: moved static JS code to a separate file included at xhtml generation time
--- a/svghmi/gen_index_xhtml.ysl2 Wed Sep 18 11:09:35 2019 +0200
+++ b/svghmi/gen_index_xhtml.ysl2 Thu Sep 19 09:01:49 2019 +0200
@@ -47,20 +47,14 @@
}
apply "@* | node()";
}
- script
- ||
- (function(){
- var relative_URI = window.location.href.replace(/^http(s?:\/\/[^\/]*)\/.*$/, 'ws$1/ws');
- var ws = new WebSocket(relative_URI);
- ws.onmessage = function (evt) {
- var received_msg = evt.data;
- alert("Message is received..."+received_msg);
- };
- ws.onopen = function (evt) {
- ws.send("test");
- };
- })();
- ||
+ script{
+ /*TODO add :
+ - pages content
+ + with ref to elt ?
+ - widgets parameters
+ */
+ include text svghmi.js
+ }
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svghmi/svghmi.js Thu Sep 19 09:01:49 2019 +0200
@@ -0,0 +1,11 @@
+(function(){
+ var relative_URI = window.location.href.replace(/^http(s?:\/\/[^\/]*)\/.*$/, 'ws$1/ws');
+ var ws = new WebSocket(relative_URI);
+ ws.onmessage = function (evt) {
+ var received_msg = evt.data;
+ alert("Message is received..."+received_msg);
+ };
+ ws.onopen = function (evt) {
+ ws.send("test");
+ };
+})();