Added opton for immediate view refresh.

This commit is contained in:
Alexander K. Hudek 2015-03-12 23:07:42 -04:00
parent bbf1a4c794
commit 626d0a6bb9
2 changed files with 8 additions and 7 deletions

View file

@ -1,4 +1,4 @@
(defproject views "1.1.0"
(defproject views "1.2.0"
:description "A view to the past helps navigate the future."
:url "https://github.com/diligenceengine/views"

View file

@ -85,12 +85,13 @@
(or (:hints (first p)) #{})))
(defn refresh-views!
"Given a collection of hints, find all dirty views."
[view-system]
(let [hints (pop-hints! view-system)]
"Given a collection of hints, or a single hint, find all dirty views and schedule them for a refresh."
([view-system hints]
(debug "refresh hints:" hints)
(mapv #(refresh-view! view-system hints %) (subscribed-views @view-system))
(swap! view-system assoc :last-update (System/currentTimeMillis))))
(swap! view-system assoc :last-update (System/currentTimeMillis)))
([view-system]
(refresh-views! view-system (pop-hints! view-system))))
(defn can-refresh?
[last-update min-refresh-interval]