Table of Contents

Class ObservableEventSubscription<T>

Namespace
WebDriverBiDi
Assembly
WebDriverBiDi.dll

The handle for a subscription created by calling Subscribe(IObserver<T>) on the IObservable<T> that ToObservable<T>(ObservableEvent<T>) returns. Disposing the handle ends the subscription; CompletionTask reports when delivery to the observer has ended.

public sealed class ObservableEventSubscription<T> : IDisposable where T : WebDriverBiDiEventArgs

Type Parameters

T

The type of event arguments containing information about the observable event.

Inheritance
ObservableEventSubscription<T>
Implements
Inherited Members

Remarks

Subscribe(IObserver<T>) is declared to return IDisposable, so the handle arrives statically typed as that interface; cast it to this type to reach CompletionTask. Each subscription owns an EventDataCollector<T> on the source event and a background delivery loop that drains it into the observer.

Properties

CompletionTask

Gets a task that completes once delivery to the observer has ended: after OnCompleted() has returned following Dispose(), or after OnError(Exception) has returned when OnNext(T) threw.

public Task CompletionTask { get; }

Property Value

Task

Remarks

The task completes successfully in both cases; an exception thrown by OnCompleted() or OnError(Exception) is discarded, because the Rx grammar makes both calls terminal. Await it after disposing the subscription to be certain the observer will receive no further calls, for example before tearing down state the observer uses.

Methods

Dispose()

Removes the subscription from the source event and completes its buffer. Items already buffered are still delivered, after which OnCompleted() is called and CompletionTask completes. Disposing more than once has no further effect.

public void Dispose()