Esempio n. 1
0
 /// <summary>
 /// Observes actions of a specific type being performed on the store.
 /// </summary>
 /// <typeparam name="T">The type of actions that the subscriber is interested in.</typeparam>
 /// <param name="filter">Filter action by origin.</param>
 /// <returns>
 /// An <see cref="IObservable{T}"/> that can be subscribed to in order to receive updates whenever an action of <typeparamref name="T"/> is performed on the store.
 /// </returns>
 public IObservable <T> ObserveAction <T>(ActionOriginFilter filter = ActionOriginFilter.Normal)
 {
     return(_actionSubject
            .Where(x => filter.HasFlag((ActionOriginFilter)x.Origin))
            .Select(x => x.Action)
            .OfType <T>());
 }
 /// <summary>
 /// Observes actions being performed on the store.
 /// </summary>
 /// <param name="filter">Filter action by origin.</param>
 /// <returns>An <see cref="IObservable{T}"/> that can be subscribed to in order to receive updates about actions performed on the store.</returns>
 public IObservable <object> ObserveAction(ActionOriginFilter filter = ActionOriginFilter.Normal)
 {
     return(_dispatchedSubject
            .Where(x => filter.HasFlag((ActionOriginFilter)x.Origin))
            .Select(x => x.Action));
 }