Skip to content

Commit 064c558

Browse files
author
teivah
committed
Return context connect
1 parent 818dca5 commit 064c558

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

observable.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ type Observable interface {
2525
BufferWithCount(count int, opts ...Option) Observable
2626
BufferWithTime(timespan Duration, opts ...Option) Observable
2727
BufferWithTimeOrCount(timespan Duration, count int, opts ...Option) Observable
28-
Connect() (Disposed, Disposable)
28+
Connect() (context.Context, Disposable)
2929
Contains(equal Predicate, opts ...Option) Single
3030
Count(opts ...Option) Single
3131
Debounce(timespan Duration, opts ...Option) Observable

observable_operator.go

+2-7
Original file line numberDiff line numberDiff line change
@@ -594,15 +594,10 @@ func (o *ObservableImpl) BufferWithTimeOrCount(timespan Duration, count int, opt
594594
}
595595

596596
// Connect instructs a connectable Observable to begin emitting items to its subscribers.
597-
func (o *ObservableImpl) Connect() (Disposed, Disposable) {
597+
func (o *ObservableImpl) Connect() (context.Context, Disposable) {
598598
ctx, cancel := context.WithCancel(context.Background())
599599
o.Observe(WithContext(ctx), connect())
600-
ch := make(chan struct{})
601-
go func() {
602-
<-ctx.Done()
603-
close(ch)
604-
}()
605-
return ch, Disposable(cancel)
600+
return ctx, Disposable(cancel)
606601
}
607602

608603
// Contains determines whether an Observable emits a particular item or not.

0 commit comments

Comments
 (0)