History

Add a few missing returns

Thibaut committed 11 years ago

Commit ba09a141 parent afbe4c32 files · +15 −2Browse files

Showing the changes to assets/javascripts (2 of 2 files). Show all

Unified · Split

2 files
  1. assets/javascripts/app/db.coffee +7 −2
  2. assets/javascripts/models/doc.coffee +8 −0
assets/javascripts/app/db.coffee+7−2
@@ -60,7 +60,9 @@ class app.DB · 59 unmodified lines
60 return60 return
61 61
62 txn = db.transaction ['docs', doc.slug], 'readwrite'62 txn = db.transaction ['docs', doc.slug], 'readwrite'
63 txn.oncomplete = -> if txn.error then onError() else onSuccess()63 txn.oncomplete = ->
64 if txn.error then onError() else onSuccess()
65 return
64 66
65 store = txn.objectStore(doc.slug)67 store = txn.objectStore(doc.slug)
66 store.clear()68 store.clear()
@@ -78,7 +80,9 @@ class app.DB · 11 unmodified lines
78 return80 return
79 81
80 txn = db.transaction ['docs', doc.slug], 'readwrite'82 txn = db.transaction ['docs', doc.slug], 'readwrite'
81 txn.oncomplete = -> if txn.error then onError() else onSuccess()83 txn.oncomplete = ->
84 if txn.error then onError() else onSuccess()
85 return
82 86
83 store = txn.objectStore(doc.slug)87 store = txn.objectStore(doc.slug)
84 store.clear()88 store.clear()
@@ -154,6 +158,7 @@ class app.DB · 69 unmodified lines
154 158
155 reset: ->159 reset: ->
156 try indexedDB?.deleteDatabase(NAME) catch160 try indexedDB?.deleteDatabase(NAME) catch
161 return
157 162
158 useIndexedDB: ->163 useIndexedDB: ->
159 !app.isSingleDoc() and !!window.indexedDB164 !app.isSingleDoc() and !!window.indexedDB
assets/javascripts/models/doc.coffee+8−0
@@ -54,6 +54,7 @@ class app.models.Doc extends app.Model · 53 unmodified lines
54 @reset data54 @reset data
55 onSuccess()55 onSuccess()
56 @_setCache data if options.writeCache56 @_setCache data if options.writeCache
57 return
57 58
58 ajax59 ajax
59 url: @indexUrl()60 url: @indexUrl()
@@ -70,6 +71,7 @@ class app.models.Doc extends app.Model · 10 unmodified lines
70 callback = =>71 callback = =>
71 @reset data72 @reset data
72 onSuccess()73 onSuccess()
74 return
73 75
74 setTimeout callback, 076 setTimeout callback, 0
75 true77 true
@@ -94,10 +96,12 @@ class app.models.Doc extends app.Model · 18 unmodified lines
94 error = =>96 error = =>
95 @downloading = null97 @downloading = null
96 onError()98 onError()
99 return
97 100
98 success = (data) =>101 success = (data) =>
99 @downloading = null102 @downloading = null
100 app.db.store @, data, onSuccess, error103 app.db.store @, data, onSuccess, error
104 return
101 105
102 ajax106 ajax
103 url: @dbUrl()107 url: @dbUrl()
@@ -112,13 +116,17 @@ class app.models.Doc extends app.Model · 8 unmodified lines
112 success = =>116 success = =>
113 @downloading = null117 @downloading = null
114 onSuccess()118 onSuccess()
119 return
115 120
116 error = =>121 error = =>
117 @downloading = null122 @downloading = null
118 onError()123 onError()
124 return
119 125
120 app.db.unstore @, success, error126 app.db.unstore @, success, error
127 return
121 128
122 getDownloadStatus: (callback) ->129 getDownloadStatus: (callback) ->
123 app.db.version @, (value) ->130 app.db.version @, (value) ->
124 callback downloaded: !!value, version: value131 callback downloaded: !!value, version: value
132 return