Commit Graph

11 Commits

Author SHA1 Message Date
Dan Holmsand 744165737f Make Reaction always call watches
Even if it is not executed automatically
2015-02-01 00:41:59 +01:00
Dan Holmsand dfd3e540f3 Use cljs.test 2015-01-31 23:09:42 +01:00
Dan Holmsand 6d9bb35996 Deprecate calling cursor with atom as second argument 2015-01-31 14:29:01 +01:00
Dan Holmsand 86bf871329 Swap order of arguments to cursor
So now it should be called as (r/cursor atom path). The old order
still works though.
2015-01-31 14:08:19 +01:00
Dan Holmsand 976d8ba4f6 Make cursor more general and flexible
Instead of passing an atom, you can now pass a function.

That function is passed one argument (the path provided to cursor)
when deref-ing, and two arguments (path and new value) when
resetting.

Remove the old setter, and the currying version.
2015-01-31 13:32:48 +01:00
Dan Holmsand a28dc812ae Check for memory leaks 2015-01-31 12:22:53 +01:00
Dan Holmsand 00b5c1d330 Add tests from reagent-cursor 2015-01-31 11:01:35 +01:00
Dan Holmsand 7244ffc25d Add test for wrap 2014-11-22 11:08:17 +01:00
Dan Holmsand f94fcd5542 Add equality test for cursor 2014-11-22 10:45:36 +01:00
Dan Holmsand 02ffe6bcfa Update cursor test 2014-11-13 19:58:56 +01:00
Sean Corfield 5d2fc0254e Add cursor support.
Adds RCursor type: wraps Reagent's RAtom along with a path that provides focus into a specific part of that atom.

Adds reagent.ratom/cursor as a constructor for the RCursor type.

Adds reagent.core/cursor as the public API. This can be called with just a path, and returns a function that accepts a Reagent atom, or with both a path and an atom.

Dereferences of a cursor behave like get-in on the underlying atom with the specified path.

If you reset! a cursor, it behaves like a swap! assoc-in on the underlying atom. If swap! a cursor, it behaves like a swap! update-in on the underlying atom.
2014-09-08 19:31:05 -07:00