remove stale requests from cache on index refresh
This commit is contained in:
parent
4cc724cee4
commit
5c46064306
@ -289,6 +289,7 @@ Index =
|
||||
Index.scrollToIndex()
|
||||
|
||||
parse: (pages, pageNum) ->
|
||||
$.cleanCache (url) -> /^\/\/a\.4cdn\.org\//.test url
|
||||
Index.parseThreadList pages
|
||||
Index.buildThreads()
|
||||
Index.sort()
|
||||
|
||||
@ -72,9 +72,9 @@ $.ajax = do ->
|
||||
r.send form
|
||||
r
|
||||
|
||||
$.cache = do ->
|
||||
do ->
|
||||
reqs = {}
|
||||
(url, cb, options) ->
|
||||
$.cache = (url, cb, options) ->
|
||||
if req = reqs[url]
|
||||
if req.readyState is 4
|
||||
cb.call req, req.evt
|
||||
@ -93,6 +93,10 @@ $.cache = do ->
|
||||
$.on req, 'abort error', rm
|
||||
req.callbacks = [cb]
|
||||
reqs[url] = req
|
||||
$.cleanCache = (testf) ->
|
||||
for url of reqs when testf url
|
||||
delete reqs[url]
|
||||
return
|
||||
|
||||
$.cb =
|
||||
checked: ->
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user