clojure で Electoron できる descjop をやってみようと思った その4.8
前の続き。
ボタンを付ける。
hello-om-based2/src_front/hello_om_based2_front/core.cljs をいじる。
(ns hello-om-based2-front.core (:require [om.core :as om :include-macros true] [om.dom :as dom :include-macros true])) (defonce app-state (atom {:message "Hello om world!"})) (defn mount-root [setting] (om/root (fn [state owner] (reify om/IRender (render [_] (dom/h1 nil ;; (:message state) (:my-env setting) )))) app-state {:target (. js/document (getElementById "app"))})) (defn init! [setting] (mount-root setting))
mount-root
を前と同じようにこんな風に修正:
(defn mount-root [setting] (om/root (fn [state owner] (reify om/IRender (render [_] (dom/div nil (dom/h1 nil ;; (:message state) (:my-env setting)) (dom/button #js { :onclick (fn [e] (js/alert "pressed!")) } "Hello"))))) app-state {:target (. js/document (getElementById "app"))}))
ボタンは出たものの、ボタンを押しても何も表示されない………。