task package
public function scheduleAppointment(function()returns(error | null) onTrigger, function(error)returns(null) | null onError, string scheduleCronExpression) returns (string | error)
Schedules an appointment task
Parameter Name | Data Type | Description |
---|---|---|
onTrigger | function()returns(error | null) | The function which gets called when the appointment falls due |
onError | function(error)returns(null) | null | The function that gets called if the onTrigger function returns an error |
scheduleCronExpression | string | Specifies the Cron expression of the schedule |
Return Variable | Data Type | Description |
---|---|---|
string | error | The unique ID of the appointment task that was scheduled |
public function scheduleTimer(function()returns(error | null) onTrigger, function(error)returns(null) | null onError, struct {int delay, int interval} schedule) returns (string | error)
Schedules a timer task
Parameter Name | Data Type | Description |
---|---|---|
onTrigger | function()returns(error | null) | The function which gets called when the timer goes off |
onError | function(error)returns(null) | null | The function that gets called if the onTrigger function returns an error |
schedule | struct {int delay, int interval} | Specifies the initial delay and interval of the timer task |
Return Variable | Data Type | Description |
---|---|---|
string | error | The unique ID of the timer task that was scheduled |
public function stopTask(string taskID) returns (error)
Stops the timer task with ID taskID
Parameter Name | Data Type | Description |
---|---|---|
taskID | string | The unique ID of the timer task that has to be stopped |
Return Variable | Data Type | Description |
---|---|---|
error | This error will be returned if an error occurs while stopping the task |