Add a few missing returns

This commit is contained in:
Thibaut 2015-01-01 16:49:53 -05:00
parent afbe4c3846
commit ba09a14ec0
2 changed files with 15 additions and 2 deletions

View file

@ -60,7 +60,9 @@ class app.DB
return
txn = db.transaction ['docs', doc.slug], 'readwrite'
txn.oncomplete = -> if txn.error then onError() else onSuccess()
txn.oncomplete = ->
if txn.error then onError() else onSuccess()
return
store = txn.objectStore(doc.slug)
store.clear()
@ -78,7 +80,9 @@ class app.DB
return
txn = db.transaction ['docs', doc.slug], 'readwrite'
txn.oncomplete = -> if txn.error then onError() else onSuccess()
txn.oncomplete = ->
if txn.error then onError() else onSuccess()
return
store = txn.objectStore(doc.slug)
store.clear()
@ -154,6 +158,7 @@ class app.DB
reset: ->
try indexedDB?.deleteDatabase(NAME) catch
return
useIndexedDB: ->
!app.isSingleDoc() and !!window.indexedDB

View file

@ -54,6 +54,7 @@ class app.models.Doc extends app.Model
@reset data
onSuccess()
@_setCache data if options.writeCache
return
ajax
url: @indexUrl()
@ -70,6 +71,7 @@ class app.models.Doc extends app.Model
callback = =>
@reset data
onSuccess()
return
setTimeout callback, 0
true
@ -94,10 +96,12 @@ class app.models.Doc extends app.Model
error = =>
@downloading = null
onError()
return
success = (data) =>
@downloading = null
app.db.store @, data, onSuccess, error
return
ajax
url: @dbUrl()
@ -112,13 +116,17 @@ class app.models.Doc extends app.Model
success = =>
@downloading = null
onSuccess()
return
error = =>
@downloading = null
onError()
return
app.db.unstore @, success, error
return
getDownloadStatus: (callback) ->
app.db.version @, (value) ->
callback downloaded: !!value, version: value
return