@joshdb/indexeddb
v1.0.3
Published
JSON Provider for JOSH
Downloads
1
Readme
IndexedDB Provider for JOSH
The IndexedDB provider uses javascript IndexedDB api to store a database in browser
Running the installer
In your project folder, you should be able to install using this command:
npm i @joshdb/indexeddb
** OR **
yarn add @joshdb/indexeddb
Usage
Using the IndexedDB provider goes as such:
Webpack
const Josh = require('@joshdb/core');
const JoshIndexedDB = require('@joshdb/indexeddb');
const db = new Josh({
name: 'testing',
provider: JoshIndexedDB,
// See below for all provider options.
providerOptions: {},
});
db.defer.then(async () => {
console.log(`Connected, there are ${await db.size} rows in the database.`);
});
CDN
<script src="https://unpkg.com/@joshdb/core"></script>
<script src="https://unpkg.com/@joshdb/indexeddb@latest/dist/main.js"></script>
<script>
const Josh = require('josh');
const JoshIndexedDB = require('@joshdb/indexeddb');
const db = new Josh({
name: 'testing',
provider: JoshIndexedDB,
// See below for all provider options.
providerOptions: {},
});
db.defer.then(async () => {
console.log(`Connected, there are ${await db.size} rows in the database.`);
});
</script>
Provider Options
| Param | Type | Description | | ----------------- | ------------------- | --------------------------- | | [providerOptions] | Object | The Provider Options Object |