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

31
LINES

< > BotCompany Repo | #1018999 // Internet Detector v2 [detects online status, Dyn Module]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 108K of libraries. Click here for Pure Java version (16101L/113K).

!7

module OnlineChecker > DynImageSurface {
  volatile transient bool online;
  
  visualize {
    ret jscroll(jBackground(Color.white, jFullCenter(imageSurface = imageSurface(image))));
  }

  start {
    preloadImagesNow(#1101405, #1101406);
    setImage(#1101404);
    thread { doEveryAndNow(10000, r actualUpdate); }
  }
  
  void actualUpdate {
    temp enter();
    time "online check" {
      online = main.areWeOnline();
    }
    setImage(online ? #1101406 : #1101405);
    S text = online ? "We are online!" : "We are offline...";
    setToolTip(imageSurface, text);
    S name = online ? "ONLINE" : "OFFLINE";
    setModuleName(name);
  }
  
  // API
  
  bool areWeOnline() { ret online; }
}

Author comment

Began life as a copy of #1018978

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1018999
Snippet name: Internet Detector v2 [detects online status, Dyn Module]
Eternal ID of this version: #1018999/19
Text MD5: eda39bf2345f20a32f95cbe299281317
Transpilation MD5: d08d65b084430701515ecd03968ae9a9
Author: stefan
Category: javax / networking
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-10-20 16:50:49
Source code size: 734 bytes / 31 lines
Pitched / IR pitched: No / No
Views / Downloads: 318 / 571
Version history: 18 change(s)
Referenced in: [show references]