Skip to main content

api.getReactiveState()

Description

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

Usage

api.getReactiveState(): object;

Returns

The method returns an object with the following properties:

{
activeProject: object,
tasks: object,
id: object,
projects: object,
readonly: object,
tags: object,
taskShape: object,
selected: object,
users: object,
historyState: object
}

Example

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

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

// subscribe to the task selection
list.api.getReactiveState().selected.subscribe((value) => {
console.log(value);
// other actions
});

Change log: The historyState parameter was added in v1.3