I'm experimenting with the following simple select box: 

(defn select-box [cursor owner]
  (reify
    om/IInitState
    (init-state [_]
      {:selected 0})
    om/IRenderState
    (render-state [_ {:keys [selected]}]
      (dom/select #js {:value selected
                       :onChange #(om/set-state! owner :selected (.. % -target 
-value))}
                  [(dom/option #js {:key 0 :value 0} "red")
                   (dom/option #js {:key 1 :value 1} "blue")]))))

(om/root select-box {}
         {:target (. js/document (getElementById "select-box"))})

Here's the cljsbuild config. When I compile in simple mode, the drop down works 
without exceptions: 

   {:id "select-box"
    :source-paths ["src-cljs" "examples/select-box/src"]
    :compiler {:output-to  "resources/public/examples/select-box/select-box.js"
               :optimizations :simple
               :pretty-print false
               :preamble ["react/react.min.js"]
               :externs ["react/externs.js"]
  
But, when I change to advanced mode like this, I'm seeing a "Uncaught 
TypeError: undefined is not a function"

   {:id "select-box"
     :source-paths ["src-cljs" "examples/select-box/src"]
     :compiler {:output-to  "resources/public/examples/select-box/select-box.js"
                :optimizations :advanced
                :pretty-print false
                :preamble ["react/react.min.js"]
                :externs ["react/externs.js"]

I'm guessing that I probably need to use ^:export somewhere, perhaps? Or maybe 
I'm missing something else simple?

Thanks, 
Dave

-- 
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