Module Duplex.Scheduler
Schedule tasks to execute after a defined amount of time
Functions
__init () | Initialize the Scheduler class |
on_idle () | Perform idle task (check when it's time to execute a task) |
add_task (ref, func, delay, ...) | Add a new task to the scheduler |
remove_task (ref) | Remove a previously scheduled task |
_execute_task (task) | Execute a given task (using the provided context or anonymously) |
ScheduledTask:__init (ref, func, delay, args) | A class representing a scheduled task |
Functions
- __init ()
- Initialize the Scheduler class
- on_idle ()
- Perform idle task (check when it's time to execute a task)
- add_task (ref, func, delay, ...)
-
Add a new task to the scheduler
Parameters:
- ref (Object) the object to use as context (optional)
- func (func) the function to call
- delay (number) the delay before executing task
- ... (Vararg) variable number of extra arguments
- remove_task (ref)
-
Remove a previously scheduled task
Parameters:
- ref (ScheduledTask) reference to the task
- _execute_task (task)
-
Execute a given task (using the provided context or anonymously)
Parameters:
- task (ScheduledTask) reference to the task
- ScheduledTask:__init (ref, func, delay, args)
-
A class representing a scheduled task
Parameters:
- ref (Object) the object to use as context (optional)
- func (func) the function to call
- delay (number) the delay before executing task
- args (table) variable number of extra arguments