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

15
LINES

< > BotCompany Repo | #1017370 // onValueChangeAndNow - monitor a value regularly

JavaX fragment (include)

static java.util.Timer onValueChangeAndNow(int interval, final F0 f, fO onChange) {
  ret doEveryAndNow(interval, new Runnable {
    bool firstTime = true;
    O lastValue;
    
    public void run {
      O value = callF(f);
      if (firstTime || neq(value, lastValue)) {
        firstTime = false;
        lastValue = value;
        callF(onChange, value);
      }
    }
  });
}

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: #1017370
Snippet name: onValueChangeAndNow - monitor a value regularly
Eternal ID of this version: #1017370/3
Text MD5: d698a263cb056003df69aecf6dea578c
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-18 15:48:59
Source code size: 395 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 365 / 391
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1017440 - onValueChange - monitor a value regularly