Skip to content

Instantly share code, notes, and snippets.

@jobez
Last active December 8, 2015 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jobez/3392bbe8411e3d7f8e48 to your computer and use it in GitHub Desktop.
Save jobez/3392bbe8411e3d7f8e48 to your computer and use it in GitHub Desktop.
scratch2.org

render function

(let [renderf (fn [data]
                      (binding [*reconciler* this
                                *shared*     (merge
                                               (:shared config)
                                               (when (:shared-fn config)
                                                 ((:shared-fn config) data)))]
                        (let [c (cond
                                  (not (nil? target)) ((:root-render config) (rctor data) target)
                                  (nil? @ret) (rctor data)
                                  :else (when-let [c' @ret]
                                          (when (mounted? c')
                                            (.forceUpdate c' data))))]
                          (when (and (nil? @ret) (not (nil? c)))
                            (println "c is" c "c type" (type c) "mounted methods" (js-keys c) "root class methods" (js-keys root-class))
                            (swap! state assoc :root root-class)
                            (reset! ret root-class)))))]
...)
 
=> '"c is" #object[Object [object Object]] 
    "c type" #object[Function "function () {}"] 
     "mounted methods" #js [props context refs updater _reactInternalInstance state render] 
      "root class methods" #js [om$next$IQueryParams$ om$next$IQueryParams$params$arity$1 om$next$IQuery$ om$next$IQuery$query$arity$1 cljs$lang$type cljs$lang$ctorStr cljs$lang$ctorPrWriter]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment