It returns the underlying atom. The only use I can currently think of is when 
you are operating with a cursor outside of the render loop and want to pull a 
new cursor at a path that was nil at the time the cursor was obtained. E. g.:

(def test-cursor (om/root-cursor app-state)) ;; app-state is rendered
                                             ;; via om/root
#_=> {}

(om/update! test-cursor :foo {})

test-cursor
#_=> {}

(:foo test-cursor)
#_=> nil ;; no cursor :(

(:foo @test-cursor)
#_=> {} ;; this is an ordinary map, again no cursor :(

;; assuming we don't have app-state handy anymore and don't know where
;; :foo is located in it
(def foo-cursor
  (-> test-cursor
      (om/state) ;; obtain app-state
      (om/root-cursor) ;; make new cursor
      (get-in (conj (om/path test-cursor) ;; locate test-cursor in the
                                          ;; new cursor
                    :foo)))) ;; obtain :foo as cursor

foo-cursor
#_=> {} ;; yay, a cursor

(om/update! foo-cursor :bar 42)

(= 42 (get-in @app-state [:foo :bar]))
#_=> true ;; it worked

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