Timer
Last updated
Last updated
The timer starts counting up from zero seconds once started and continues until manually stopped. It can also display negative seconds left. Moreover, it's capable of exceeding its initial set duration, which allows it to show progress beyond 100%. This functions is useful for tracking tasks that may exceed their expected time frames, offering flexibility in monitoring extended workflows.
To quickly start with timers:
Find the Functions
panel on the left-hand side of the screen.
Expand Utilities
and then Timer
.
Create a timer instance with the create
function.
Expand the instance that appeared in the panel and get started with using the timer.
Use the create
and delete
functions to manage the existing timers. Existing timers can be seen in the functions panel on the left under Timer
. Yellow ones are uninstantiated and green ones are ready for use.
To create
a timer:
Insert a timer name in the yellow field.
Click the trigger field to create an instance of the timer. You should see the timer in the functions panel go from yellow to green.
To delete
a timer:
Insert the name of an existing timer in the yellow field
Click the trigger field.
The instance in the functions panel will turn yellow again, until the yellow field of the create
function is cleared, or the create
function is deleted from the board.
To utilize timers, you can find functions tied to each instance when you expand the instance with a click on the arrow in front of it.
The setTotalSeconds
function sets the timer's total duration in seconds. Enter the duration in the input field as an integer. The countdown starts when the start
function is activated.
The getTotalSeconds
function returns the number of seconds of the total timer duration.
The getSecondsLeft
function returns the number of seconds left for the timer to run.
The getProgress
function returns the progress of the timer in percent.
The getState
function returns whether the timer is stopped
or started
as a string.
After triggering the start
function, the timer counts up and the state gets set to started
. It will not stop until the stop function is triggered.
After triggering the stop
function, the timer stops counting, the state gets reset to stopped
and the progress to 0.
The onTick
function is triggered every time the timer updates. It shows the seconds left in the first field immediately after the timer changes. The function needs to be started once by being triggered to begin listening to the timer once the app is running. The resetting of the timer when it reaches 0 and a stopped timer will not register as a tick. You can use the first field just like any output field.
To listen for when the timer has reached its end, you can use onTimeup
. On time up, this function fills its first field with an event that can be used as an input to other functions. Just like onTick
, this function needs to be started by being triggered once the app is running.
Currently, the event that gets filled in the listener field is empty. It can still be used by dragging it on a trigger and changing the trigger mode to on output update
.