existsProject()
Beschreibung
Prüft, ob das angegebene Projekt im DataStore vorhanden ist
Verwendung
existsProject({ id: string | number }): boolean;
Parameter
id- (erforderlich) die ID des Projekts
Rückgabewert
Die Methode gibt true zurück, wenn das Projekt vorhanden ist, andernfalls false.
Beispiel
const { ToDo, Toolbar } = todo;
const list = new ToDo("#root", {
projects: [
{ id: "first", label: "First project" },
{ id: "second", label: "Second project" },
{ id: "third", label: "Third project" },
]
});
const toolbar = new Toolbar("#toolbar", {
api: list.api,
});
// prüfen, ob Projekte vorhanden sind
list.existsProject({ id: 1 }); // -> false
list.existsProject({ id: "first" }); // -> true
Verwandter Artikel: Projektobjekt