File tree Expand file tree Collapse file tree 2 files changed +21
-18
lines changed Expand file tree Collapse file tree 2 files changed +21
-18
lines changed Original file line number Diff line number Diff line change 11(ns cljs.proxy
2- (:refer-global :only [Proxy isNaN]))
3-
4- (deftype SimpleCache [^:mutable obj ^:mutable cnt]
5- Object
6- (set [this k v]
7- (when (== cnt 1024 )
8- (.clear this))
9- (unchecked-set obj k v)
10- (set! cnt (inc cnt))
11- v)
12- (get [this k]
13- (unchecked-get obj k))
14- (clear [this]
15- (set! obj #js {})
16- (set! cnt 0 )))
17-
18- (defn write-through [f]
2+ (:refer-global :only [Proxy isNaN])
3+ (:require [cljs.proxy.impl :refer [SimpleCache]]))
4+
5+ (defn- write-through [f]
196 (let [cache (SimpleCache. #js {} 0 )]
207 (fn [x]
218 (let [v (.get cache x)]
229 (if (some? v)
2310 v
2411 (.set cache x (f x)))))))
2512
26- (def desc
13+ (def ^{:private true }
14+ desc
2715 #js {:configurable true
2816 :enumerable true })
2917
Original file line number Diff line number Diff line change 1+ (ns cljs.proxy.impl )
2+
3+ (deftype SimpleCache [^:mutable obj ^:mutable cnt]
4+ Object
5+ (set [this k v]
6+ (when (== cnt 1024 )
7+ (.clear this))
8+ (unchecked-set obj k v)
9+ (set! cnt (inc cnt))
10+ v)
11+ (get [this k]
12+ (unchecked-get obj k))
13+ (clear [this]
14+ (set! obj #js {})
15+ (set! cnt 0 )))
You can’t perform that action at this time.
0 commit comments