Skip to content

Commit

Permalink
Update advanced.md
Browse files Browse the repository at this point in the history
  • Loading branch information
aritchie committed Jun 9, 2024
1 parent 94d5dc9 commit 08b8802
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/content/docs/client/mediator/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@ From there, we wrap each call to each event handler in any registered event midd

Lastly, we execute these using Task.WhenAll to ensure all event handlers are executed in parallel.


## What If I can't add an interface, participate in DI... I'm stuck... how do I listen to an event?
The main `Shiny.Mediator.IMediator` interface does have a standard MessagingCenter subscription method. It suffers from the same issue as the standard messaging center, you must Dispose of the call when you're done with it.

```csharp
// we assume you have access to your DI container statically
var sub = Container.GetService<IMediator>().Subscribe<SomeEvent>(async (@event, ct) => {
// do something
});

// when you're done
sub.Dispose();
```


## Event Collectors

### What are they?
Expand Down

0 comments on commit 08b8802

Please sign in to comment.