[![NPM version][npm-image]][npm-url]
DB is javascript library / wrapper used to communicate with IndexedDB efficiently. DB have set of predefined function which helps developers ease in writing object oriented code for storing, manipulating and retrieving data in indexedDB.
Changes in 1.0.2:
- Updated code to remove unwanted methods and variables.
<script src="DB.js"></script>
npm i --save DB;
// ES2015
import {DB} from '@dharmesh-hemaram/DB';
//require JS
let DB = require('@dharmesh-hemaram/DB').DB;
//AMD
define(['@dharmesh-hemaram/DB'], function (package) {
let DB = package.DB;
});
create database configuration file db_confog.json
{
"databaseName":"testDB",
"version":1,
"tables":[
{
"name":"customers",
"keyPath":"customerId",
"autoIncrement":false,
"columns":[
{
"name":"customerName",
"nullable":false,
"type":"string"
},{}
]
},{}
]
}
import {DB} from '@dharmesh-hemaram/DB';
DB.setup(databaseJSON).then(dbInst => console.log(dbInst));
DB.getInst().databaseName.tableName.get().then(result).catch(error);
If this project help you reduce time to develop, you can give me a cup of coffee :)
The code in this project is licensed under Apache 2.0 license.