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

27
LINES

< > BotCompany Repo | #1007761 // Instant Chat - now really without delay

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (8405L/56K/185K).

1  
!7
2  
3  
static double timeout = 60; // 60 seconds safety
4  
static double refreshDelay = 0; // 0 seconds to refresh
5  
6  
static L<S> data = synchroList(ll("Start."));
7  
8  
html {
9  
  S add = params.get("add");
10  
  if (nempty(add) && neq(last(data), add)) data.add(add);
11  
  
12  
  int i = toInt(params.get("i"));
13  
  int n;
14  
  long start = sysNow();
15  
  while (l(data) == i
16  
    && licensed()
17  
    && sysNow() < start+timeout*1000)
18  
    sleep(10);
19  
  if ((n = l(data)) < i) i = 0;
20  
  ret hrefresh(refreshDelay, selfLink(i := n))
21  
    + hcenter(
22  
        join("<br>", map(f dynamize, cloneList(data)))
23  
      + p("Bla bla here:", style := "margin-top: 40px")
24  
      + hform(htextinput("add", "", autofocus := 1, style := "text-align: center") + " " + hsubmit("Say"))
25  
    );
26  
    
27  
}

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: #1007761
Snippet name: Instant Chat - now really without delay
Eternal ID of this version: #1007761/5
Text MD5: 0fed4f48f648b103697dfdc6a0235b7b
Transpilation MD5: 10d75685b21caf50d6867ee5fe36f4af
Author: stefan
Category: javax / a.i. / html
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-04-04 00:38:26
Source code size: 766 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 385 / 829
Version history: 4 change(s)
Referenced in: [show references]