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

19
LINES

< > BotCompany Repo | #1004683 // doEvery - install a java.util.Timer

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2419L/16K).

1  
// firstDelay = delay
2  
static FixedRateTimer doEvery(long delay, final O r) {
3  
  ret doEvery(delay, delay, r);
4  
}
5  
6  
static FixedRateTimer doEvery(long delay, long firstDelay, final O r) {
7  
  FixedRateTimer timer = new(shorten(programID() + ": " + r, 80));
8  
  timer.scheduleAtFixedRate(smartTimerTask(r, timer, toInt(delay)), toInt(firstDelay), toInt(delay));
9  
  ret vmBus_timerStarted(timer);
10  
}
11  
12  
// reversed argument order for fun
13  
static FixedRateTimer doEvery(double initialSeconds, double delaySeconds, final O r) {
14  
  ret doEvery(toMS(delaySeconds), toMS(initialSeconds), r);
15  
}
16  
17  
static FixedRateTimer doEvery(double delaySeconds, final O r) {
18  
  ret doEvery(toMS(delaySeconds), r);
19  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1004683
Snippet name: doEvery - install a java.util.Timer
Eternal ID of this version: #1004683/11
Text MD5: 782e2f2e74c2c91a3299d9098b7319f7
Transpilation MD5: 9ce35c1eb57e641a7ebd2ae0c2b645bf
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-09-23 13:48:17
Source code size: 697 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 901 / 988
Version history: 10 change(s)
Referenced in: [show references]