Dexie
Dexie.js (Official home page: dexie.org) is a library that makes it super simple to use indexedDB - the standard client-side database in browsers. Read more about Dexie on it's README or at the home page.
Dexie
is the main class and the default export of the library. An instance of this class represents an indexedDB database connection.
Syntax
Parameters
dbName: String
Database name
options: Object (optional)
API Options
Options
addons: Array
Explicitly define the addons to activate for this db instance
autoOpen: boolean
Default true. Whether database will open automatically on first query.
Supply an alternate implementation of indexedDB. If supplying this, also supply IDBKeyRange that works with that implementation.
An implementation of the IDBKeyRange interface that works with provided indexedDB implementation.
allowEmptyDB: boolean
If opening in dynamic mode (not defining a schema) the call to db.open() will normally reject if the database didn't exist and this option is false or not set. By setting this option to true, Dexie.open() will succeed to create a new empty database when opening it dynamically.
modifyChunkSize: number
chromeTransactionDurability: 'default' | 'strict' | 'relaxed'
cache: 'cloned' | 'immutable' | 'disabled'
(since 4.0.1-alpha.17) Override the default caching behavior. Default is 'cloned' (dexie@>4 only) and allows optimistic updates to trigger liveQueries before transactions commit. 'immutable' also enables optimistic updates with some optimization - less cloning and less memory consumption but return values from read-operations from live queries are frozen. 'disabled' gives same behavior as dexie@3 with no cache or optimistic updates.
If the 'addons' option is omitted, it will default to the value of Dexie.addons.
Return Value
Dexie
Sample
Sample: Open existing database 'as is'
Sample: Instantiate a Dexie with custom addon
How options tells how to apply addons:
Methods
Specify the database schema (object stores and indexes) for a certain version.
Subscribe to events
Open database and make it start functioning.
Returns an object store to operate on
Start a database transaction
close()
Close the database
Delete the database
Returns true if database is open.
Returns true if database failed to open.
Returns the native IDBDatabase instance.
Enable on('ready') subscribers to use db before open() is complete.
Properties
The database name.
Each object store defined in version().stores() gets a Table instance named by the object store.
Javascript Array containing all Table instances.
Version of current database
Static Methods
Declare an async function in today's modern browsers (2015) without the need for a transpiler.
Spawn an async function in today's modern browsers (2015) without the need for a transpiler.
Delete a database.
List all database names at current origin.
Detect whether a database with the given name exists.
Retrieve a property from an object given a key path.
Modify a property in an object given a key path and value.
Delete a property from an object given a key path.
Shallow clones an object.
Deep clones an object.
Create a a new scope where current transaction is ignored.
Override existing method and be able to call the original method.
Creates a function and populates its prototype with given structure.
Fixes the prototype chain for OOP inheritance.
Dexie.extend()
Set given additional properties into given object.
Create a set of events to subscribe to and fire.
Static Properties
Array of extended constructors.
Get / set debug mode.
Contains the semantic version string from package.json.
Contains the version number of Dexie as a numeric comparable decimal value.
Last updated