Created
August 8, 2016 22:17
-
-
Save tvanhens/a48b60befcb70af79aa230b721ae54db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns example.core | |
(:require [goog.dom :as gdom] | |
[om.dom :as dom] | |
[om.next :as om :refer-macros [defui]])) | |
(defmulti read om/dispatch) | |
(def parse (om/parser {:read read})) | |
(defmethod read :default | |
[{:keys [ast state query reconciler] :as m} k _] | |
(println "running query for: " k) | |
{:value "foobar"}) | |
(defui Root | |
Object | |
(componentWillMount [this] | |
(om/set-query! this {:query [:foobar]})) | |
(render [this] | |
(dom/div nil (pr-str (om/get-query this))))) | |
(def reconciler (om/reconciler {:parser parse | |
;; TODO: Figure out how to trigger | |
;; rerender without cb | |
:state {}})) | |
(om/add-root! reconciler Root (gdom/getElement "app")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment