Skip to content

Commit

Permalink
Correct small readme things
Browse files Browse the repository at this point in the history
  • Loading branch information
marcojakob committed Sep 8, 2014
1 parent a6ab765 commit b24fe58
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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**:
Expand Down

0 comments on commit b24fe58

Please sign in to comment.