Skip to content

Dexie.backendDB()

David Fahlander edited this page May 8, 2014 · 5 revisions

Syntax

var idb_db = db.backendDB();

Return Value

IDBDatabase

Description

Returns the native IndexedDB database instance.

Sample

var db = new Dexie("MyDB");
db.version(1).stores({items: "++id"});
db.open().then(function(){
    var idb = db.backendDB();
    var idbtrans = idb.transaction (['items'], 'readonly');
    var itemsStore = idbtrans.objectStore('items');
    var req = itemsStore.get(2);
    req.onsuccess = function () {
        if (req.result)
            alert ("Got item " + JSON.stringify(req.result));
        else
            alert ("Item 2 not found");
    };
});
Clone this wiki locally