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 return
txn = db.transaction ['docs', doc.slug], 'readwrite' 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 = txn.objectStore(doc.slug)
store.clear() store.clear()
@ -78,7 +80,9 @@ class app.DB
return return
txn = db.transaction ['docs', doc.slug], 'readwrite' 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 = txn.objectStore(doc.slug)
store.clear() store.clear()
@ -154,6 +158,7 @@ class app.DB
reset: -> reset: ->
try indexedDB?.deleteDatabase(NAME) catch try indexedDB?.deleteDatabase(NAME) catch
return
useIndexedDB: -> useIndexedDB: ->
!app.isSingleDoc() and !!window.indexedDB !app.isSingleDoc() and !!window.indexedDB

View file

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