Created
June 26, 2014 20:05
-
-
Save shaunlebron/bca0fd36f26dee6fc6dd to your computer and use it in GitHub Desktop.
problem with using strings as cursors in Om
This file contains hidden or 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
; 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