Closed fiatjaf closed 7 years ago
That's perfectly clear. My use-case was React rerendering, but I was doing it all wrong.
I found code from react-easy-state and almost solved my problems using it.
Actually using exec
on direct (React triggered) renders would be nicer there. I plan to refactor it in the future, as it relies on undocumented observe
behavior.
I just realize I'm posting on nx-js/framework instead of nx-js/observer-util. Sorry, I really thought I was on the other repo.
Can I close this?
exec executes an observer function. returning values from an observer function is not encouraged, as they can be triggered internally by observable mutations - not only by the user. they do stuff with side effects instead of return values (not only in nx-js, but generally in transparent reactive programming). allowing exec to return the value would make things inconsistent as it would encourage you to add a return value to your observers, which would never be used on internal triggers.
i hope this make sense. what is your use case?