Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

18
LINES

< > BotCompany Repo | #1014681 // subBot_html_webSocketBasedLogView

JavaX fragment (include)

1  
static S subBot_html_webSocketBasedLogView() {
2  
  ret loadJQuery()
3  
    + hpre("", id := 'logView)
4  
    + hreconnectingWebSockets()
5  
    + hjs_htmlencode()
6  
    + hjavascript([[
7  
      var ws = new ReconnectingWebSocket("${URI}");
8  
      ws.onmessage = function(event) {
9  
        var d = event.data;
10  
        if (d == "clear")
11  
          $("#logView").html("");
12  
        else {
13  
          $("#logView").append(htmlencode(d.substring(1)));
14  
          window.scrollBy(0, 1000000); // keeps X coordinate
15  
        }
16  
      };
17  
    ]].replace("${URI}", subBot_myWebSocketURI());
18  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1014681
Snippet name: subBot_html_webSocketBasedLogView
Eternal ID of this version: #1014681/2
Text MD5: 5d4aad5e5d75324f4f147429a574e0d0
Author: stefan
Category: javax / web
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-04-30 00:21:24
Source code size: 576 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 396 / 420
Version history: 1 change(s)
Referenced in: [show references]