/simple-indexedDB

Api for doing simple and intuitive operations towards indexedDB

Primary LanguageTypeScript

simple-indexedDB

Api for doing simple and intuitive operations towards indexedDB.

The code for the live version is on the 1.0-branch. I am going to rewrite the whole project on this branch.

Installation

yarn add simple-indexeddb

npm install simple-indexeddb

import {createStore, put, remove} from 'simple-indexeddb'; 

Creating the database

    createStore("myDatabase", "myStore");

Adding/Replacing items

    // adding (specifying path to key, 'id')
    put("myDatabase", "myStore", {id : 1, text : "buy milk", done : false}, "id");  

    // replacing (same key!)
    put("myDatabase", "myStore", {id : 1, text : "walk the dog", done : false}, "id"); 

Removing items

        // same key as earlier 
    remove(1, "myStore", "myDatabase");