Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
problem with using strings as cursors in Om
; Suggested in Om Basic Tutorial for making strings work as cursors
(extend-type string
ICloneable
(-clone [s] (js/String. s)))
(extend-type js/String
ICloneable
(-clone [s] (js/String. s))
om/IValue
(-value [s] (str s)))
(def app-state (atom {:text "Foo"}))
(om/root
(fn [app owner]
(dom/h1 nil
(let [text (:text app)]
(if (= "Foo" text) "Passed." "Failed."))))
app-state
{:target (. js/document (getElementById "app"))})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment