Skip to main content

update-task

Description

Fires when updating a task

Usage

"update-task": ({
id: string | number,
task: 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 task
  • task - (required) the object of the updated task
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