FlowingCode / SimpleTimerAddon

Vaadin Flow integration of https://github.com/annsonn/simple-timer
Apache License 2.0
5 stars 3 forks source link

Added event that gets launched every second on running timer #24

Closed MrBlueex closed 1 year ago

javier-godoy commented 1 year ago

Hello. Thanks for your contribution.

Note that addCurrentTimeChangeListener already implements throttling (the listener is not be notified more often than the specified period):

    timer.addCurrentTimeChangeListener(ev -> {
      Notification.show("Timer: " + timer.getCurrentTime());
    }, 1, TimeUnit.SECONDS);

Please let us know in case your use case cannot be implemented by using that method.

image

MrBlueex commented 1 year ago

Thanks, I must have skipped lines while reading your code

It is working as aspected

javier-godoy commented 1 year ago

I'm glad it worked. I created an issue for improving the documentation of addCurrentTimeChangeListener, since the purpose of the additional long/TimeUnit parameters is not clear.