Skip to content

Commit

Permalink
asdf
Browse files Browse the repository at this point in the history
  • Loading branch information
CalvinWilkinson committed Jan 23, 2024
1 parent 8990d82 commit 00b3571
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,6 @@ unsubscriber.Dispose(); // Will only unsubscribe from this subscription

<details closed><summary>How To Unsubscribe Example</summary>

> [!Tip]
> If you want to receive a single notification, unsubscribe from further notifications by calling the `Dispose()`
> method on the `IDisposable` object returned by the _**Reactable**_ object. All reactable objects return an unsubscriber object for unsubscribing at a later time. The unsubscriber is returned when invoking the `Subscribe()` method. Unsubscribing can be done anytime except in the notification delegates `onReceive`, `onRespond`, and `onReceiveRespond`.
```cs
var mySubscription = new ReceiveSubscription(
id: subId,
Expand All @@ -119,11 +115,6 @@ var mySubscription = new ReceiveSubscription(

<details closed><summary>How Not To Unsubscribe Example</summary>

> [!Tip]
> If an attempt is made to unsubscribe from notifications inside of any of the notification delegates, a `NotificationException` will be
> thrown. This is an intentional design to prevent the removal of any internal subscriptions during the notification process.
> Of course, you can add a `try...catch` in the notification delegate to swallow the exception, but again this is not recommended.
Below is an example of what you _**SHOULD NOT**_ do.
```cs
IDisposable? unsubscriber;
Expand All @@ -143,6 +134,15 @@ messenger.Push(subId);
```
</details>

> [!Tip]
> If you want to receive a single notification, unsubscribe from further notifications by calling the `Dispose()`
> method on the `IDisposable` object returned by the _**Reactable**_ object. All reactable objects return an unsubscriber object for unsubscribing at a later time. The unsubscriber is returned when invoking the `Subscribe()` method. Unsubscribing can be done anytime except in the notification delegates `onReceive`, `onRespond`, and `onReceiveRespond`.
> [!Tip]
> If an attempt is made to unsubscribe from notifications inside of any of the notification delegates, a `NotificationException` will be
> thrown. This is an intentional design to prevent the removal of any internal subscriptions during the notification process.
> Of course, you can add a `try...catch` in the notification delegate to swallow the exception, but again this is not recommended.
<h3 style="font-weight:bold;color: #00BBC6">One way push notifications</h3>

To facilitate _**one way**_ data transfer through push notifications, you can employ the `PushReactable<TIn>` or `PullReactable<TOut>` types while subscribers utilize the `ReceiveSubscription<TIn>` or `RespondSubscription<TOut>` types for their subscriptions. Setting up and using this approach follows the same steps as in the previous example. In this context, the term one-directional signifies that data exclusively flows in one direction either out from the source to the subscription delegate or from the subscription delegate to the source.
Expand Down

0 comments on commit 00b3571

Please sign in to comment.