ThreadWatcher: Move parsing code out of anonymous function.

This commit is contained in:
ccd0 2015-01-10 22:24:26 -08:00
parent c6fcbf5de1
commit f4ee994bf7

View File

@ -159,7 +159,8 @@ ThreadWatcher =
for thread in threads for thread in threads
ThreadWatcher.fetchStatus thread ThreadWatcher.fetchStatus thread
return return
fetchStatus: ({boardID, threadID, data}) -> fetchStatus: (thread) ->
{boardID, threadID, data} = thread
return if data.isDead and !Conf['Show Unread Count'] return if data.isDead and !Conf['Show Unread Count']
{fetchCount} = ThreadWatcher {fetchCount} = ThreadWatcher
if fetchCount.fetching is 0 if fetchCount.fetching is 0
@ -168,6 +169,9 @@ ThreadWatcher =
fetchCount.fetching++ fetchCount.fetching++
$.ajax "//a.4cdn.org/#{boardID}/thread/#{threadID}.json", $.ajax "//a.4cdn.org/#{boardID}/thread/#{threadID}.json",
onloadend: -> onloadend: ->
ThreadWatcher.parseStatus.call @, thread
parseStatus: ({boardID, threadID, data}) ->
{fetchCount} = ThreadWatcher
fetchCount.fetched++ fetchCount.fetched++
if fetchCount.fetched is fetchCount.fetching if fetchCount.fetched is fetchCount.fetching
fetchCount.fetched = 0 fetchCount.fetched = 0