You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 4, 2019. It is now read-only.
Right now, creating the ObservableComponent and obtaining the observable attached to the component is done in two steps:
// create observable componentconstMyComponent=observeComponent('div')('onClick');// obtain the observable attached to itconstmyObs$=fromComponent(MyComponent);
observeComponent could be changed to instead return both the component we are observing, as well as the observable attached:
However, this would be less ergonomic for people who may be utilizing this library without es2015+.
Pros:
Reduces API surface (only one function!)
Removes the need to mutate the wrapped React component by attaching the observable as a property
Removes fromComponent function, which is slightly redundant and potentially confusing to new users.
Cons:
Relies on ES2015+ syntax to be really ergonomic
Would be a breaking change
Loses similarity to obtaining observables from other event-producing objects in most libraries (Rx.Observable.from(), Kefir.fromCallback/fromEvents/fromPoll, etc...)
The text was updated successfully, but these errors were encountered:
lilactown
changed the title
Return observable instead of using fromComponent
Return observable from observeComponent instead of using fromComponent
Jan 14, 2017
lilactown
changed the title
Return observable from observeComponent instead of using fromComponent
API changes
Jan 17, 2017
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Proposal 1: observeComponent returns observable
Right now, creating the
ObservableComponent
and obtaining the observable attached to the component is done in two steps:observeComponent
could be changed to instead return both the component we are observing, as well as the observable attached:This would remove the need for
fromComponent
, however it would require users to use object destructuring and renaming:It could also be done by returning an array instead of an object to avoid the verbosity of renaming the object properties:
However, this would be less ergonomic for people who may be utilizing this library without es2015+.
Pros:
fromComponent
function, which is slightly redundant and potentially confusing to new users.Cons:
Rx.Observable.from()
,Kefir.fromCallback/fromEvents/fromPoll
, etc...)The text was updated successfully, but these errors were encountered: