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).

1  
!7
2  
3  
cmodule MonitorOffTimer > DynPrintLogAndEnabled {
4  
  switchable double timeout = 60.0; // seconds
5  
  
6  
  transient new RestartableCountdown countdown;
7  
  
8  
  start {
9  
    dm_restartOnFieldChange timeout();
10  
    dm_require("#1020622/UserActivityDetector");
11  
    startCountdown();
12  
    dm_vmBus_onMessage userActivityDetected(r startCountdown);
13  
  }
14  
  
15  
  void bam enter {
16  
    // determining whether monitor is on is difficult, so we just
17  
    // turn it off every time the countdown expires
18  
    if (enabled) monitorOff();
19  
    startCountdown();
20  
  }
21  
  
22  
  void startCountdown {
23  
    countdown.start(max(timeout, 10.0), r bam);
24  
  }
25  
}

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: 113 / 4657
Version history: 2 change(s)
Referenced in: [show references]