Reduce unnecessary calls to GM_getValue.
This commit is contained in:
parent
d61f5350ed
commit
8bcec61542
@ -49,7 +49,6 @@ class DataBoard
|
|||||||
@save()
|
@save()
|
||||||
|
|
||||||
get: ({boardID, threadID, postID, defaultValue}) ->
|
get: ({boardID, threadID, postID, defaultValue}) ->
|
||||||
$.forceSync @key
|
|
||||||
if board = @data.boards[boardID]
|
if board = @data.boards[boardID]
|
||||||
unless threadID
|
unless threadID
|
||||||
if postID
|
if postID
|
||||||
@ -66,6 +65,9 @@ class DataBoard
|
|||||||
thread
|
thread
|
||||||
val or defaultValue
|
val or defaultValue
|
||||||
|
|
||||||
|
forceSync: ->
|
||||||
|
$.forceSync @key
|
||||||
|
|
||||||
clean: ->
|
clean: ->
|
||||||
$.forceSync @key
|
$.forceSync @key
|
||||||
for boardID, val of @data.boards
|
for boardID, val of @data.boards
|
||||||
|
|||||||
@ -97,6 +97,7 @@ ThreadWatcher =
|
|||||||
onIndexRefresh: ->
|
onIndexRefresh: ->
|
||||||
{db} = ThreadWatcher
|
{db} = ThreadWatcher
|
||||||
boardID = g.BOARD.ID
|
boardID = g.BOARD.ID
|
||||||
|
db.forceSync()
|
||||||
for threadID, data of db.data.boards[boardID] when not data.isDead and threadID not of g.BOARD.threads
|
for threadID, data of db.data.boards[boardID] when not data.isDead and threadID not of g.BOARD.threads
|
||||||
if Conf['Auto Prune']
|
if Conf['Auto Prune']
|
||||||
ThreadWatcher.db.delete {boardID, threadID}
|
ThreadWatcher.db.delete {boardID, threadID}
|
||||||
@ -114,6 +115,7 @@ ThreadWatcher =
|
|||||||
fetched: 0
|
fetched: 0
|
||||||
fetching: 0
|
fetching: 0
|
||||||
fetchAllStatus: ->
|
fetchAllStatus: ->
|
||||||
|
ThreadWatcher.db.forceSync()
|
||||||
return unless (threads = ThreadWatcher.getAll()).length
|
return unless (threads = ThreadWatcher.getAll()).length
|
||||||
for thread in threads
|
for thread in threads
|
||||||
ThreadWatcher.fetchStatus thread
|
ThreadWatcher.fetchStatus thread
|
||||||
|
|||||||
@ -20,6 +20,7 @@ Unread =
|
|||||||
node: ->
|
node: ->
|
||||||
Unread.thread = @
|
Unread.thread = @
|
||||||
Unread.title = d.title
|
Unread.title = d.title
|
||||||
|
Unread.db.forceSync()
|
||||||
Unread.lastReadPost = Unread.db.get
|
Unread.lastReadPost = Unread.db.get
|
||||||
boardID: @board.ID
|
boardID: @board.ID
|
||||||
threadID: @ID
|
threadID: @ID
|
||||||
@ -57,6 +58,7 @@ Unread =
|
|||||||
Header.scrollTo root, down if Header.getBottomOf(root) < 0
|
Header.scrollTo root, down if Header.getBottomOf(root) < 0
|
||||||
|
|
||||||
sync: ->
|
sync: ->
|
||||||
|
return unless Unread.lastReadPost?
|
||||||
lastReadPost = Unread.db.get
|
lastReadPost = Unread.db.get
|
||||||
boardID: Unread.thread.board.ID
|
boardID: Unread.thread.board.ID
|
||||||
threadID: Unread.thread.ID
|
threadID: Unread.thread.ID
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user