Project object
Getting a project object
To get a project object, use the getProject()
method:
const projects = [
{ id: "first", label: "First project" },
{ id: "second", label: "Second project" },
{ id: "third", label: "Third project" },
];
const list = new ToDo("#root", { projects });
const toolbar = new Toolbar("#toolbar", {
api: list.api,
});
list.getProject({ id: "first" }); // -> {id: 'first', label: 'First project'}
Checking if a project exists
To check whether a project exists or not, use the existsProject()
method:
const projects = [
{ id: "first", label: "First project" },
{ id: "second", label: "Second project" },
{ id: "third", label: "Third project" },
];
const list = new ToDo("#root", { projects });
const toolbar = new Toolbar("#toolbar", {
api: list.api,
});
list.existsProject({ id: 1 }); // -> false
list.existsProject({ id: "first" }); // -> true