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

23
LINES

< > BotCompany Repo | #1016087 // Notebook Lid

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

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

1  
!7
2  
3  
cmodule NotebookLid > DynBigNumber {
4  
  transient Bool openLast;
5  
  transient long openSince;
6  
  
7  
  start {
8  
    setDescription("Notebook Lid");
9  
    ownTimer(doEvery(1.0, r updateMe));
10  
  }
11  
  
12  
  void update {
13  
    Bool open = isNotebookLidOpen();
14  
    if (isTrue(open) && isFalse(openLast)) {
15  
      openSince = now();
16  
      dm_say("Hello");
17  
    } else if (isFalse(open) && isTrue(openLast))
18  
      dm_say("Bye");
19  
    openLast = open;
20  
    setValue(now() < openSince + 10000 ? "JUST OPENED"
21  
      : nullFalseTrue(open, "?", "CLOSED", "OPEN"));
22  
  }
23  
}

Author comment

Began life as a copy of #1016082

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1016087
Snippet name: Notebook Lid
Eternal ID of this version: #1016087/15
Text MD5: 0b47b77b6fe7a483a6d8f28cd083cc17
Transpilation MD5: a6a17c908dd50ece825e13b59db69af7
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: 2019-02-08 13:42:50
Source code size: 565 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 482 / 7461
Version history: 14 change(s)
Referenced in: [show references]