Skip to content

Commit 84798d3

Browse files
committed
docstring
1 parent 5685fa7 commit 84798d3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/main/cljs/cljs/proxy.cljs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
:enumerable true})
1717

1818
(defn builder
19+
"EXPERIMENTAL: Return a JavaScript Proxy ctor fn with the provided key-fn. You
20+
can proxy ClojureScript map and vectors. Access pattern from JavaScript
21+
will lazily wrap collection values in Proxy if needed. Note key-fn
22+
is only used for proxied ClojureScript maps. This function should map
23+
strings to the appropriate key representation. All maps proxied from the
24+
same ctor fn will share the same key-fn cache."
1925
([]
2026
(builder keyword))
2127
([key-fn]
@@ -93,6 +99,7 @@
9399

94100
(def proxy (builder))
95101

102+
(def raw-map {:foo 1 :bar 2})
96103
(def proxied-map (proxy {:foo 1 :bar 2}))
97104

98105
(require '[goog.object :as gobj])
@@ -105,6 +112,11 @@
105112
(dotimes [i 1e7]
106113
(unchecked-get proxied-map "foo")))
107114

115+
(def k :foo)
116+
(time
117+
(dotimes [i 1e7]
118+
(get raw-map k)))
119+
108120
(def proxied-vec (proxy [1 2 3 4]))
109121
(alength proxied-vec)
110122
(time

0 commit comments

Comments
 (0)