Class ObservableEventInvocable<T>
- Namespace
- WebDriverBiDi
- Assembly
- WebDriverBiDi.dll
Producer-side implementation of a subject in the Observer pattern for events, allowing a producer to notify observers.
public class ObservableEventInvocable<T> : ObservableEvent<T> where T : WebDriverBiDiEventArgs
Type Parameters
TThe type of event arguments containing information about the observable event.
- Inheritance
-
ObservableEventInvocable<T>
- Inherited Members
- Extension Methods
Constructors
ObservableEventInvocable(string)
Initializes a new instance of the ObservableEventInvocable<T> class.
public ObservableEventInvocable(string eventName)
Parameters
eventNamestringThe name of the event.
ObservableEventInvocable(string, uint)
Initializes a new instance of the ObservableEventInvocable<T> class.
public ObservableEventInvocable(string eventName, uint maxObserverCount)
Parameters
eventNamestringThe name of the event.
maxObserverCountuintThe maximum number of handlers that may observe this event.
Methods
InvokeNotifyObserversAsync(T)
Asynchronously notifies observers when this observable event occurs. Each observer is notified independently; an exception thrown by one observer does not prevent subsequent observers from being notified. If exactly one observer throws, the original exception is rethrown. If multiple observers throw, an AggregateException containing all caught exceptions is thrown after all observers have been notified.
public Task InvokeNotifyObserversAsync(T notifyData)
Parameters
notifyDataTThe data of the event.
Returns
- Task
The task object representing the asynchronous operation.
Exceptions
- AggregateException
Thrown when multiple observer handlers throw an exception.
InvokeSetObserverErrorReporter(Func<EventObserverErrorInfo, Task>)
Sets the reporter used to surface observer failures that occur after the handler has already returned to the caller. This is intended for producers that need to handle asynchronous observer errors outside the normal exception propagation path.
public void InvokeSetObserverErrorReporter(Func<EventObserverErrorInfo, Task> reporter)
Parameters
reporterFunc<EventObserverErrorInfo, Task>The reporter callback.