주요 콘텐츠로 건너뛰기

existsProject()

설명

지정된 프로젝트가 DataStore에 존재하는지 확인합니다

사용법

existsProject({ id: string | number }): boolean;

매개변수

  • id - (필수) 프로젝트의 ID

반환값

프로젝트가 존재하면 true를, 그렇지 않으면 false를 반환합니다

예제

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,
});

// 프로젝트 존재 여부 확인
list.existsProject({ id: 1 }); // -> false
list.existsProject({ id: "first" }); // -> true

관련 문서: 프로젝트 객체