run

infix fun run(task: Task): Scheduler.ScheduledTask

Queue a task when the condition is met. This task will run (and self-reset if finished) for as long as the condition is met.

Note this means that the task provided will run from start-to-finish when the condition is true, which means it won't execute exclusively while the condition is met, rather have the capability to be started when the condition is met. This means continuous iterations of a true condition will try to keep this task queued at all times, resetting the task internally when it is completed. Keep this in mind if working with looping/long tasks, as you might experience runaway tasks. See finishIf for fine-grain "run exclusively if" control.

This method can only be called once per ScheduledTask. If you do not mention timing control, this task will be run immediately when the condition is met, ending when the task ends.

Return

Current builder for additional task parameters

Parameters

task

The task to run.


infix fun run(runnable: Runnable): Scheduler.ScheduledTask

Implicitly make a new RunTask to run as the condition is met. This callback will requeue as many times as the trigger is met.

This method can only be called once per ScheduledTask, see a TaskGroup for multiple task execution. If you do not mention timing control, this task will be run immediately when the condition is met, ending immediately as it is an RunTask.

Return

Current builder for additional task parameters

Parameters

runnable

The code to run


Implicitly make a new RunTask to run as the condition is met. This callback will requeue as many times as the trigger is met.

This method can only be called once per ScheduledTask, see a TaskGroup for multiple task execution. If you do not mention timing control, this task will be run immediately when the condition is met, ending immediately as it is an RunTask.

Return

Current builder for additional task parameters

Parameters

name

task name

runnable

The code to run