scheduler
Manages scheduling and execution of tasks
Table of Contents
Constants
| Name | Type | Value | Description |
|---|---|---|---|
QUERY_INTERVAL |
Integer | 1000 |
Time (ms) interval for ticks |
SLEEP_THRESHOLD |
Integer | 60000 |
Time (ms) threshold to execute tasks after app has been asleep/inactive for |
_jQueryCleanupTaskId |
String | specific to local | ID of the task that manages cleanup of jQuery fragments |
_lastTickTime |
Integer | specific to local | Time (ms) value of the last passed tick |
_tasks |
Object | - | Object containing all tasks that are run periodically |
Methods
init
Description:
Sets the _lastTickTime to current unix time, adds the jQuery cleanup task and sets _jQueryCleanupTaskId
removePeriodicTask
Parameters:
taskIDString
Description:
Removes the task with ID taskID
restartPeriodicTask
Parameters:
taskIDString
Description:
Restarts the task with ID taskID
schedulePeriodicTask
Parameters:
intervalIntegerfuncFunction- ??? (optional)
Description:
Creates a task that is executes func with the set interval
tick
Description:
This function initializes the interval for the scheduler
updatePeriodicTask
Parameters:
taskIDStringintervalIntegerfuncFunction
Description:
Update task with the ID taskID to have a new interval and/or func
_fireTask
Parameters:
taskObject
Description:
Executes the callback function of specified task
_handleTick
Description:
Handles ticks and executes callback functions if required