       fn(version)
       return
 
-    @db (db) ->
+    @db (db) =>
       unless db
         fn(false)
         return
 
-      txn = db.transaction ['docs'], 'readonly'
+      txn = @idbTransaction db, stores: ['docs'], mode: 'readonly'
       store = txn.objectStore('docs')
 
       req = store.get(doc.slug)

  loadDocsCache: (db) ->
    @cachedDocs = {}

    txn = db.transaction ['docs'], 'readonly'
    store = txn.objectStore('docs')

    req = store.openCursor()

        onError()
        return

      txn = @idbTransaction db, stores: ['docs', doc.slug], mode: 'readwrite', ignoreError: false
      txn.oncomplete = =>
        delete @cachedDocs?[doc.slug]
        onSuccess()
        return
      txn.onerror = (event) ->
        event.preventDefault()
        onError(event)
        return

      store = txn.objectStore(doc.slug)
