Skip to main content

getProject()

Description

Gets an object of the project by its ID

Usage

getProject({ id: string | number }): object;

Parameters

  • id - (required) the ID of the project

Returns

The method returns an object with data of the project

Example

const { ToDo, Toolbar } = todo;
const { tasks, users } = getData();

const list = new ToDo("#root", {
tasks,
users,
projects: [
{ id: "first", label: "First project" },
{ id: "second", label: "Second project" },
{ id: "third", label: "Third project" },
]
});

const toolbar = new Toolbar("#toolbar", {
api: list.api,
});

// get the data object of the project
list.getProject({ id: "first" }); // -> {id: 'first', label: 'First project'}

Related article: Project object