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

25
LINES

< > BotCompany Repo | #1027646 // Monitor Off If No User Activity

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

Uses 911K of libraries. Click here for Pure Java version (7423L/39K).

!7

cmodule MonitorOffTimer > DynPrintLogAndEnabled {
  switchable double timeout = 60.0; // seconds
  
  transient new RestartableCountdown countdown;
  
  start {
    dm_restartOnFieldChange timeout();
    dm_require("#1020622/UserActivityDetector");
    startCountdown();
    dm_vmBus_onMessage userActivityDetected(r startCountdown);
  }
  
  void bam enter {
    // determining whether monitor is on is difficult, so we just
    // turn it off every time the countdown expires
    if (enabled) monitorOff();
    startCountdown();
  }
  
  void startCountdown {
    countdown.start(max(timeout, 10.0), r bam);
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, unoaxrwscvea, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1027646
Snippet name: Monitor Off If No User Activity
Eternal ID of this version: #1027646/3
Text MD5: daf166c550df836c8f50be9e249fcbac
Transpilation MD5: 45be851879d29c89535cf2307e35843f
Author: stefan
Category: javax / stefan's os
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-03-28 12:09:29
Source code size: 643 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 108 / 4652
Version history: 2 change(s)
Referenced in: [show references]