Skip to content

Commit c56d961

Browse files
committed
hide everything except builder
1 parent 6c1e4da commit c56d961

File tree

2 files changed

+21
-18
lines changed

2 files changed

+21
-18
lines changed

src/main/cljs/cljs/proxy.cljs

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,17 @@
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

src/main/cljs/cljs/proxy/impl.cljs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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)))

0 commit comments

Comments
 (0)