Status: Placeholder. Only scribbles. Don't read yet.
Broadbrush:
re-frame.core/def-view
functiondef-view
associates a keyword
with a (reagent) render function:my-view
) can be used in hiccup to identify the renderer. eg: [:my-view "Hello world"]
def-view
allows various values to be injected
as args into the view renderWhy:
dispatch
and subscribe
will help view functions to be slightly more pure. dispatch
still kinda a problem.context
which will help with "multiple re-frame apps on the one page" problemWhat might need to be injected (as args) into a view:
subscribe
and dispatch
frame
supplied via context
(subscribe and dispatch obtained from frame)XXX searches up the DOM heirarchy looking for a frame
context then extracts dispatch and subscribe. Sounds inefficient.
Associate the keyword :my-view-id
with a renderer using def-view
:
(def-view
:my-view-id
;; indicate what `context` is required
[:dispatch :subscribe :context XXX]
;; the renderer
;; last argument `context` is a map of:
;; - `:subs` - a vector of subscription values?
;; - :dispatch and :subscribe
;; - :context - a vector of context values
;;
(fn [a-str context]
(let [XXXX]
)))
Use of :my-view-id
:
[:my-view-id "Hello"]
Associate the keyword :my-view-id
with a renderer using def-view
:
(def-view
:my-view-id
;; injection function
;; indicate what subscriptions we wish to obtain
;; obtain a dispatch for use
;; get the context id if you want to
;;
:subscriptions
(fn [_ id]
{:subs [[:item ]]
:context ["name1", "name2")})
;; the renderer
;; last argument `ins` is a map of:
;; - `:subs` - a vector of subscription values?
;; - :dispatch and :subscribe
;; - :context - a vector of context values
;;
(fn [a-str ins]
(let [XXXX]
)))
Use of :my-view-id
:
[:my-view-id "Hello"]
Misc Notes:
context
(beyond the current frame)XXX There's a nasty problem with frames and subscriptions. How does the signal function know what frame to create new subscriptions against???
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close