Skip to content

Commit

Permalink
Added client timestamp as metadata to history entries.
Browse files Browse the repository at this point in the history
  • Loading branch information
awkay committed Feb 26, 2016
1 parent 93e007f commit 4b8eedb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/main/om/next/cache.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
(deftype Cache [arr index size]
Object
(add [this id x]
(if (<= size (alength arr))
(let [id' (.shift arr)]
(swap! index #(-> % (dissoc id') (assoc id x))))
(swap! index assoc id x))
(let [x' (vary-meta x assoc :client-time (js/Date.))]
(if (<= size (alength arr))
(let [id' (.shift arr)]
(swap! index #(-> % (dissoc id') (assoc id x'))))
(swap! index assoc id x')))
(.push arr id))
(get [this id]
(get @index id)))
Expand Down

0 comments on commit 4b8eedb

Please sign in to comment.