1 | // f : func -> A |
2 | // onChange: voidfunc(A) or Runnable |
3 | static java.util.Timer onValueChange(int interval, fO f, fO onChange) { |
4 | ret doEvery(interval, new Runnable { |
5 | O lastValue = pcallF(f); |
6 | |
7 | public void run { |
8 | O value = pcallF(f); |
9 | if (neq(value, lastValue)) { |
10 | lastValue = value; |
11 | callF(onChange, value); |
12 | } |
13 | } |
14 | }); |
15 | } |
Began life as a copy of #1017370
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: | #1017440 |
Snippet name: | onValueChange - monitor a value regularly |
Eternal ID of this version: | #1017440/3 |
Text MD5: | f4938fc8633e43a929202d1a31f5485c |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-07-22 09:28:13 |
Source code size: | 377 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 390 / 412 |
Version history: | 2 change(s) |
Referenced in: | [show references] |