Skip to content

Commit

Permalink
Merge pull request #632 from awkay/timestamps
Browse files Browse the repository at this point in the history
Added client timestamps to history as metadata
  • Loading branch information
swannodette committed Feb 29, 2016
2 parents 8bbdebf + 4b8eedb commit 8f31b2d
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 8f31b2d

Please sign in to comment.