mirror of
https://github.com/freeCodeCamp/devdocs
synced 2024-11-16 19:48:10 +01:00
Add a few missing returns
This commit is contained in:
parent
afbe4c3846
commit
ba09a14ec0
2 changed files with 15 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue