fortune-indexeddb-with-bundle
v1.0.3
Published
IndexedDB adapter for Fortune with bundle.
Downloads
1
Readme
Fortune IndexedDB
This is an IndexedDB adapter for Fortune.js. Various performance and compatibility optimizations are included:
- Runs in a Web Worker so that database operations don't block the main thread, and uses MessagePack for messaging.
- Loads all records in memory so that unnecessary database reads are avoided.
- Primary keys are universally unique, which solves some compatibility problems.
$ npm install fortune-indexeddb --save
Usage
This module works in web browsers only, and falls back to memory if IndexedDB is not available:
const fortune = require('fortune')
const indexedDBAdapter = require('fortune-indexeddb')
const store = fortune(recordTypes, {
adapter: [ indexedDBAdapter, {
// Name of the IndexedDB database to use. Defaults to `fortune`.
name: 'fortune'
} ]
})
License
This software is licensed under the MIT license.