Remove event from $.cache interface.

This commit is contained in:
ccd0 2019-03-09 00:06:51 -08:00
parent 496043342f
commit 4c329af6e0
2 changed files with 9 additions and 8 deletions

View File

@ -15,8 +15,9 @@ class Fetcher
@root.textContent = "Loading post No.#{@postID}..."
if @threadID
$.cache "#{location.protocol}//a.4cdn.org/#{@boardID}/thread/#{@threadID}.json", (e, isCached) =>
@fetchedPost e.target, isCached
that = @
$.cache "#{location.protocol}//a.4cdn.org/#{@boardID}/thread/#{@threadID}.json", ({isCached}) ->
that.fetchedPost @, isCached
else
@archivedPost()
@ -80,8 +81,9 @@ class Fetcher
if isCached
api = "#{location.protocol}//a.4cdn.org/#{@boardID}/thread/#{@threadID}.json"
$.cleanCache (url) -> url is api
$.cache api, (e) =>
@fetchedPost e.target, false
that = @
$.cache api, ->
that.fetchedPost @, false
return
# The post can be deleted by the time we check a quote.

View File

@ -87,7 +87,7 @@ do ->
$.cache = (url, cb, options) ->
if req = reqs[url]
if req.readyState is 4
$.queueTask -> cb.call req, req.evt, true
$.queueTask -> cb.call req, {isCached: true}
else
req.callbacks.push cb
return req
@ -96,10 +96,9 @@ do ->
return if not (req = $.ajax url, options)
catch err
return
$.on req, 'load', (e) ->
@evt = e
$.on req, 'load', ->
for cb in @callbacks
do (cb) => $.queueTask => cb.call @, e, false
do (cb) => $.queueTask => cb.call @, {isCached: false}
delete @callbacks
$.on req, 'abort error', rm
req.callbacks = [cb]