api/LibTasks-1.0
LibTasks-1.0 provides central storage for various types of tasks.
Internally it has a table in which tasks are stored.
Access to this table is done using the API which is split into two parts: The task source and the display part.
The task source uses the three methods AddOrUpdateTask, RemoveTask and HasTask.
The display uses mainly the callbacks registered by RegisterCallback.
library:GetFieldType(...)
Gets the type of a field
Parameters
- ...
- specifies the field, a single value for field in a task, successive values are used to access sub-tables
Return value
type of the field
library:IsFieldRequired(...)
Checks whether a field is required in a task.
Parameters
- ...
- specifies the field, a single value for field in a task, successive values are used to access sub-tables
Return value
whether the field is required
library:VerifyTask(taskData)
Verfies that a task has the correct types for every field and that all required fields are present and that no unsupported fields are present
Parameters
- taskData
- a task
Return value
whether this is a correct task
mixins.RegisterCallback(self, eventName, method, ...)
Parameters
- self
- your addon, not the library
- eventName
- one of the four allowed events: EVENT_NEW, EVENT_CHANGED, EVENT_NEW_OR_CHANGED or EVENT_REMOVED
- method
- the method to call if the event occurs
- ...
- additional arguments, passed to CallbackHandler.RegisterCallback
mixins:AddOrUpdateTask(taskData, verifyTask)
Parameters
- taskData
- data for this task. This is a table.
- verifyTask
- if set, the provided table will be verified against the specification
Return value
taskData the exact same table
mixins:HasTask(taskData)
Parameters
- taskData
- the task to check
Return value
whether the task exists
mixins:RemoveTask(taskData)
Parameters
- taskData
- the same table that was added previously
subTask
- description
- , required , string , description of the sub-task
- progressType
- , required , string(progresType) , type of the progress information, one of ( boolean; number: requires progressIs and progressNeed)
- complete
- , required , boolean , whether the sub-task is complete
- progressIs
- , optional , number , how many are complete
- progressNeed
- , optional , number , how many are needed
taskData
- name
- , required , string , name of the task, should be short
- description
- , optional , string , description of the task, may be long
- icon
- , optional , string(texpath) , icon to show
- class
- , required , string , dot seperated class description It is up do displays how to interpret this.
- done
- , optional , boolean , whether the tasks is done
- actionType
- , optional , string
- actionLink
- , optional , string
- OnClick
- , optional , function , function to call when the task is clicked obviously not secure
- subTasks
- , optional , table(subTask) , a collection of sub-tasks
Comments