-
Notifications
You must be signed in to change notification settings - Fork 338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version 3 #377
Version 3 #377
Conversation
Proposal for changing observe API: Current : for v := range observable.Observe() {}
// OR
obs := observable.Observe()
for {
select {
case item, ok :=<- obs:
}
} Proposed : this is highly inspired by rxjs API design type Subscription interface {
Unsubscribe()
}
observable[T].Subscribe(onNext func(T), onError func(error), onCompleted func()) Subscription The current API is very confusing, users have no way to control the subscription (unsubscribe the stream when needed), and they required to handle the error or data manually. I suggested we move the abstraction into internal function, and expose only the required functions. |
…`, `Map` operators
The new version of API will look like this. @teivah any comments atm? Note: This stream data flow will be processed synchronously, that's why the function named as SubscribeSync |
There are significant changes in the API. For example, Previous rxgo.Defer([]Producer{func(ctx context.Context, next chan<- Item) {
next <- Of(1)
next <- Of(2)
next <- Error(fmt.Errorf("some error"))
}}) Current rxgo.Defer(func() rxgo.IObservable[uint] {
return rxgo.Interval(1000)
}) AND creating an observable is as easy as : newObservable(func(sub Subscriber[int]) {
for i := 0; i < 10; i++ {
Next[int](I).Send(sub)
time.Sleep(time.Second)
}
Complete[int]().Send(sub)
}) |
I will take a look on that after finish the general API, I think should be feasible. |
…bleNotification` interface
I'm IDLE for some time due to work, will continue on this, so far the basic functionality is OK to go atm. |
@si3nloong hello, is this PR still active? I would love to pick it up to get a feel about maintaining this package, but don't want to over step if you have timed plan to complete it. |
@davidlondono @si3nloong Wanted to bump the thread to see if this PR will ever get picked up again. |
I'm interested to know if this pull request is still thing as I am in the process of defining my own V3 which uses generics, not sure about the other issues that have been identfied because I'm not sure if they will affect what I need for my own projects. |
This is a draft PR for the upcoming release version
v3
, it will break and redesign the whole reactive API using the generics feature offered by Go 1.18. Technically, this PR will resolve issues #375 #250 #343, as well as some missing features such as #362 #347.Alpha Version
CHANGELOG :
vendor
packages and usego.mod
insteadREADME
and API documentationBeta Version
CHANGELOG :
BehaviorSubject
Request for comments :