Skip to main content

api.getState()

Description

Gets an object with the current properties of the DataStore of To Do List

Usage

api.getState(): object;

Returns

The method returns an object with the following properties:

{
activeProject: {set: any, update: any, subscribe: any}
tasks: {...}
id: {...}
projects: {...}
readonly: {...}
tags: {...}
taskShape: {...}
selected: {...}
users: {...}
}

Example

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

// create To do list
const list = new ToDo("#root", {
tasks,
users,
projects
});

const state = list.api.getState();
console.log(state);