Skip to content

craigbuckler/asayer-idbstate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

  1. js/lib/indexeddb.js - an IndexedDB wrapper library with Promisifies the API.
  2. js/lib/state.js - a state management object with get and set methods.

An example todo application demonstrates usage:

  1. index.html - page
  2. css/main.css - basic styles
  3. js/main.js - single entry point which loads required modules
  4. js/components/todo-list.js - displays current todo list and handles removing tasks
  5. js/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.

About

Using IndexDB to Manage State in JavaScript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published