0.0.0 • Published 2 years ago
domact v0.0.0
Using IndexDB to Manage State in JavaScript
This project demonstrates how to use the browser's IndexedDB database to manage state in applications.
The project provides two primary files:
js/lib/indexeddb.js
- an IndexedDB wrapper library with Promisifies the API.js/lib/state.js
- a state management object withget
andset
methods.
An example todo application demonstrates usage:
index.html
- pagecss/main.css
- basic stylesjs/main.js
- single entry point which loads required modulesjs/components/todo-list.js
- displays current todo list and handles removing tasksjs/components/todo-add.js
- todo entry form which handles adding tasks
Both components manage state through js/lib/state.js
.
Copy all files to a web server or launch one, e.g. using Node.js:
npx small-static-server
and open index.html
in a web browser.
0.0.0
2 years ago