Uses 911K of libraries. Click here for Pure Java version (4801L/23K).
1 | !7 |
2 | |
3 | cmodule TestFlexibleRateTimer > DynPrintLog { |
4 | transient FlexibleRateTimer timer = new(1); |
5 | transient SimpleLiveValue<S> lvRate = stringLiveValue(); |
6 | |
7 | S formattedFrequency() { |
8 | ret formatDouble(timer.getFrequency(), 3); |
9 | } |
10 | |
11 | start { |
12 | timer.verbose = true; |
13 | lvRate.onChange(rLater(1000, r { |
14 | S s = trim(lvRate!); |
15 | if (eq(s, formattedFrequency())) ret; |
16 | Double hz = parseDoubleOpt(s); |
17 | if (hz != null) |
18 | timer.setFrequencyImmediately(hz); |
19 | })); |
20 | timer.onFrequencyChanged(runAndReturn(r { lvRate.set(formattedFrequency()) })); |
21 | |
22 | timer.setRunnableAndStart(rEnter { print("blubb " + localTimeWithMS()) }); |
23 | } |
24 | |
25 | visualize { |
26 | ret northAndCenterWithMargins( |
27 | withLabelLeftAndRight("Rate:", jLiveValueTextField_bothWays(lvRate), "Hz"), super.visualize()); |
28 | } |
29 | |
30 | void cleanMeUp { cleanUp(timer); } |
31 | } |
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1025194 |
Snippet name: | Test FlexibleRateTimer v1 (OK, but not shortened and not persistent) |
Eternal ID of this version: | #1025194/9 |
Text MD5: | e38e25e8db46a6491ec43111105983d3 |
Transpilation MD5: | 3d0b910a16430a24f694d3adc74f6a27 |
Author: | stefan |
Category: | javax |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-09-13 13:50:03 |
Source code size: | 891 bytes / 31 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 303 / 585 |
Version history: | 8 change(s) |
Referenced in: | [show references] |