I'd like to see the display name of views I'm building so I can report on what 
components are being rendered via a generic instrument / wrapper component (see 
below).

Can anyone point me in the right direction please.

Note: build* returns a ReactElement



(def counters (atom {}))

(defn debug-view [[f cursor opts] owner]
  (reify om/IRender
    (render [_]
      (let [view (om/build* f cursor opts)
            name (if (satisfies? om/IDisplayName view)
                   (om/display-name name) ; Never happens
                   :no-display-name)]
            (swap! counters update-in [(str render "-" name]] inc)
        view))))

(defn main []
  (enable-counter-reporting)
  (om/root Form app-state
    {:target     (. js/document (getElementById "Content"))
     :instrument (fn [f cursor opts]
                   (swap! counters update-in [:instrument] inc)
                   (om/build* debug-view [f cursor opts]))}))

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to