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

31
LINES

< > BotCompany Repo | #1025194 // Test FlexibleRateTimer v1 (OK, but not shortened and not persistent)

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

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

!7

cmodule TestFlexibleRateTimer > DynPrintLog {
  transient FlexibleRateTimer timer = new(1);
  transient SimpleLiveValue<S> lvRate = stringLiveValue();
  
  S formattedFrequency() {
    ret formatDouble(timer.getFrequency(), 3);
  }

  start {
    timer.verbose = true;
    lvRate.onChange(rLater(1000, r {
      S s = trim(lvRate!);
      if (eq(s, formattedFrequency())) ret;
      Double hz = parseDoubleOpt(s);
      if (hz != null)
        timer.setFrequencyImmediately(hz);
    }));
    timer.onFrequencyChanged(runAndReturn(r { lvRate.set(formattedFrequency()) }));
    
    timer.setRunnableAndStart(rEnter { print("blubb " + localTimeWithMS()) });
  }
  
  visualize {
    ret northAndCenterWithMargins(
      withLabelLeftAndRight("Rate:", jLiveValueTextField_bothWays(lvRate), "Hz"), super.visualize());
  }

  void cleanMeUp { cleanUp(timer); }
}

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: 224 / 483
Version history: 8 change(s)
Referenced in: [show references]