react name is already so overloaded that I think we want to avoid that.
Looks like just calling notify-deref-watcher! is enough. That function doesn't modify the atom itself, but stores reference to current reactive context to the atom. Reagent will then use IWatchable-add-watch (and -remove-watch) to make reactive context to listen to this atom. Because regular atom implements this protocol same as Ratom.
While it would be simple to just provide single function to use instead of regular deref to use with normal atoms, I think better API might be to provide function to wrap atoms, so we can replace deref implementation. This way we could later also modify other methods, if necessary for some reason.
Related to #546
react
name is already so overloaded that I think we want to avoid that.Looks like just calling
notify-deref-watcher!
is enough. That function doesn't modify the atom itself, but stores reference to current reactive context to the atom. Reagent will then useIWatchable
-add-watch
(and-remove-watch
) to make reactive context to listen to this atom. Because regular atom implements this protocol same as Ratom.While it would be simple to just provide single function to use instead of regular
deref
to use with normal atoms, I think better API might be to provide function to wrap atoms, so we can replace deref implementation. This way we could later also modify other methods, if necessary for some reason.