File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 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]
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])
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
You can’t perform that action at this time.
0 commit comments