Class ObservableEventExtensions
- Namespace
- WebDriverBiDi
- Assembly
- WebDriverBiDi.dll
Extension methods for ObservableEvent<T>.
public static class ObservableEventExtensions
- Inheritance
-
ObservableEventExtensions
- Inherited Members
Methods
ToObservable<T>(ObservableEvent<T>)
Returns an IObservable<T> adapter for this ObservableEvent<T>, enabling integration with Reactive Extensions (Rx) operators and any code that consumes the standard IObservable<T>/IObserver<T> interfaces.
public static IObservable<T> ToObservable<T>(this ObservableEvent<T> source) where T : WebDriverBiDiEventArgs
Parameters
sourceObservableEvent<T>The ObservableEvent<T> to adapt.
Returns
- IObservable<T>
An IObservable<T> whose Subscribe(IObserver<T>) method creates an independent channel-backed subscription for each caller. Each call to Subscribe(IObserver<T>) counts as one observer against MaxObserverCount.
Type Parameters
TThe type of event arguments containing information about the observable event.
Remarks
The returned IObservable<T> partially satisfies the Rx push-stream contract:
- OnNext(T) is called for each event on a background thread as items are drained from the subscription's internal channel.
- OnCompleted() is called after the subscription handle returned by Subscribe(IObserver<T>) is disposed, once all buffered items have been delivered.
- OnError(Exception) is called if OnNext(T) throws; it is not called for exceptions thrown by other observers on the same ObservableEvent<T>.
The subscription handle returned by Subscribe(IObserver<T>) is an ObservableEventSubscription<T>. Disposing it removes the subscription from the source event, completes the internal channel, and triggers OnCompleted() once the drain loop exits; its CompletionTask task completes when that has happened.
Exceptions
- ArgumentNullException
Thrown when
sourceis null.