java.lang.Object
org.praxislive.code.userapi.Trigger.Timer
- Enclosing class:
Trigger
A timer used for scheduling one-off or repeat invocations of a
Trigger. Use Trigger.timer() to access the timer for a trigger.-
Method Summary
Modifier and TypeMethodDescriptionbooleanisActive()Check whether this timer is active, with either a one-shot or repeat event scheduled.booleanisRepeat()Check whether this timer is active and set to repeat.repeat(double seconds) Set the timer to trigger on repeat at the provided rate.schedule(double seconds) Schedule a one-off trigger after the provided delay.stop()Stop the timer.
-
Method Details
-
isActive
public boolean isActive()Check whether this timer is active, with either a one-shot or repeat event scheduled.- Returns:
- scheduled
-
isRepeat
public boolean isRepeat()Check whether this timer is active and set to repeat.- Returns:
- active on repeat
-
repeat
Set the timer to trigger on repeat at the provided rate. If the timer is not currently active on repeat, the start time will be set to the current time. If the timer is already active on repeat, the previous trigger time will continue to be the start time. Any scheduled one-off event will be cancelled.- Parameters:
seconds- period of timer in seconds- Returns:
- this for chaining
-
schedule
Schedule a one-off trigger after the provided delay. Any repeat schedule will be cancelled.- Parameters:
seconds- timer delay in seconds- Returns:
- this for chaining
-
stop
Stop the timer.- Returns:
- this for chaining
-