Add installation instructions
This commit is contained in:
parent
2cc7e722b6
commit
83010942f1
26
README.md
26
README.md
@ -1,5 +1,7 @@
|
||||
# Event Bus
|
||||
|
||||
## Introduction
|
||||
|
||||
This library allows passing events between different objects without them having a direct reference to each other.
|
||||
Any class can be made an event by implementing the `IEvent` interface.
|
||||
|
||||
@ -10,6 +12,8 @@ To listen to events, register event handling methods using the `Event` annotatio
|
||||
For this to work, the method must have a return type of `void` and declare a single parameter of the desired event type.
|
||||
Additionally, the class containing the method must implement the `EventListener` interface.
|
||||
|
||||
## A Simple Example
|
||||
|
||||
Lets look at a simple example: we declare the empty class `SimpleEvent` that implements `IEvent` and can thus be used as an event.
|
||||
|
||||
```java
|
||||
@ -43,3 +47,25 @@ public class SimpleEventListener implements EventListener {
|
||||
```
|
||||
|
||||
In this case, an event bus is created and used locally. In a more sophisticated example the class would acquire an external event bus that is used by multiple classes.
|
||||
|
||||
## Installation
|
||||
|
||||
Event Bus is currently hosted at [kske.dev](https://kske.dev).
|
||||
To include it inside your project, just add the Maven repository and the dependency to your `pom.xml`:
|
||||
|
||||
```xml
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>kske-repo</id>
|
||||
<url>https://kske.dev/maven-repo</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>dev.kske</groupId>
|
||||
<artifactId>event-bus</artifactId>
|
||||
<version>0.0.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user