update-task
Description
Fires when updating a task
Usage
"update-task": ({
id: string | number,
task: object,
skipProvider?: boolean,
batch?: object[]
}) => void;
Parameters
The callback of the update-task event can take an object with the following parameters:
id
- (required) the id of the updated tasktask
- (required) the object of the updated task- Additional parameters that can be applied to the RestDataProvider work:
skipProvider
- (optional) allows skipping events sent to RestDataProvider; if false (default), RestDataProvider works with the event, true - RestDataProvider skips the eventbatch
- (optional) an array of updated tasks objects
info
To handle the inner events, you can use the Event Bus methods
Example
const { ToDo, Toolbar } = todo;
const {tasks, projects, users} = getData();
const list = new ToDo("#root", {
tasks,
projects,
users
});
const toolbar = new Toolbar("#toolbar", {
api: list.api,
});
// subscribe to the "update-task" event
list.api.on("update-task", ({id, task}) => {
console.log("The", id, "task is updated. New task object is", task);
});
Related article: Operations with tasks