Skip to content

Commit 7ea47f2

Browse files
committedMar 8, 2020
Updated readme
1 parent 12d5678 commit 7ea47f2

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed
 

‎readme.md

+14-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Blazor.EventAggregator is a lightweight Event Aggregator for Blazor.
44

5-
*25.9.2019: Updated to work with .NET Core v3.0.0*
5+
* 3/2020: Updated to work with .NET Core v3.1.0
66

77
Event aggregator is used for indirect component to component communication. In event aggregator pattern you have message/event publishers and subscribers. In the case of Blazor, component can publish its events and other component(s) can react to those events.
88

@@ -16,11 +16,11 @@ Also note that the library has only been tested with the server-side version of
1616

1717
## Getting Started
1818

19-
First register EventAggregator as singleton in app’s ConfigureServices:
19+
First register EventAggregator in app’s ConfigureServices:
2020
```
2121
public void ConfigureServices(IServiceCollection services)
2222
{
23-
services.AddSingleton<EventAggregator.Blazor.IEventAggregator, EventAggregator.Blazor.EventAggregator>();
23+
services.AddEventAggregator();
2424
}
2525
```
2626

@@ -104,6 +104,16 @@ public class CounterListenerComponent : ComponentBase, IHandle<CounterIncreasedM
104104
}
105105
}
106106
```
107+
108+
## Note about auto refresh
109+
110+
The library can try to automatically call subscriber component's StateHasChanged after it has handled the event. By default this functionality is disabled. You can enable it through options:
111+
112+
```
113+
services.AddEventAggregator(options => options.AutoRefresh = true);
114+
```
115+
116+
Auto refresh is based on reflection and it assumes that the subscriber inherits from ComponentBase.
107117

108118
## Samples
109119

@@ -112,7 +122,7 @@ The project site contains a full working sample of the code-behind model in the
112122
## Requirements
113123
The library has been developed and tested using the following tools:
114124

115-
* .NET Core 3.0
125+
* .NET Core 3.1
116126
* Visual Studio 2019
117127

118128
## Acknowledgements

0 commit comments

Comments
 (0)
Please sign in to comment.