Skip to content

Commit

Permalink
Added opton for immediate view refresh.
Browse files Browse the repository at this point in the history
  • Loading branch information
akhudek committed Mar 13, 2015
1 parent bbf1a4c commit 626d0a6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
13 changes: 7 additions & 6 deletions src/views/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
(debug "refresh hints:" hints)
(mapv #(refresh-view! view-system hints %) (subscribed-views @view-system))
(swap! view-system assoc :last-update (System/currentTimeMillis))))
"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)))
([view-system]
(refresh-views! view-system (pop-hints! view-system))))

(defn can-refresh?
[last-update min-refresh-interval]
Expand Down

0 comments on commit 626d0a6

Please sign in to comment.