From b24fe5811ff90b04c81e8759bfd5c5585807e94a Mon Sep 17 00:00:00 2001 From: marcojakob Date: Mon, 8 Sep 2014 15:25:02 +0200 Subject: [PATCH] Correct small readme things --- README.md | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index ee3a554..c3cad22 100644 --- a/README.md +++ b/README.md @@ -35,12 +35,32 @@ to each other. This creates a tight coupling between the controllers. By communication through an **Event Bus**, the coupling is reduced. -![Event Bus](https://raw.githubusercontent.com/marcojakob/dart-event-bus/master/doc /event-bus.png) +![Event Bus](https://raw.githubusercontent.com/marcojakob/dart-event-bus/master/doc/event-bus.png) ## Usage -### 1. Define Events + +### 1. Create an Event Bus + +Create an instance of `EventBus` and make it available to other classes. + +Usually there is just one Event Bus per application, but more than one may be +set up to group a specific set of events. + +```dart +EventBus eventBus = new EventBus(); +``` + +You can alternatively use the `HierarchicalEventBus` that filters events by +event class **including** its subclasses. + +```dart +EventBus eventBus = new EventBus.hierarchical(); +``` + + +### 2. Define Events Any Dart class can be used as an event. @@ -61,25 +81,6 @@ class NewOrderEvent { ``` -### 2. Create Event Bus - -Create an instance of `EventBus` and make it available to other classes. - -Usually there is just one Event Bus per application, but more than one may be -set up to group a specific set of events. - -```dart -EventBus eventBus = new EventBus(); -``` - -You can alternatively use the `HierarchicalEventBus` that filters events by -event class **including** its subclasses. - -```dart -EventBus eventBus = new EventBus.hierarchical(); -``` - - ### 3. Register Listeners Register listeners for a **specific events**: