Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xhyrom/mashe
Simple, fast, and easy to use EventBus for Java
https://github.com/xhyrom/mashe
bus emitter event handler java listener
Last synced: 27 days ago
JSON representation
Simple, fast, and easy to use EventBus for Java
- Host: GitHub
- URL: https://github.com/xhyrom/mashe
- Owner: xhyrom
- License: mit
- Created: 2022-09-22T17:40:45.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-31T10:19:30.000Z (almost 2 years ago)
- Last Synced: 2024-10-06T05:42:14.383Z (about 1 month ago)
- Topics: bus, emitter, event, handler, java, listener
- Language: Java
- Homepage:
- Size: 696 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Mashe
Simple, fast, and easy to use Event Handling for Java.
## Usage
```java
import hyro.mashe.Mashe;
import hyro.mashe.types.Event;
import hyro.mashe.annotations.Listen;public class Example {
public static void main(String[] args) {
// Create a new mashe
Mashe mashe = new Mashe();// Register a listener (you can also use annotations)
mashe.register(ExampleEvent.class, (event) -> {
System.out.println("Hello World!");
});// Register events with Listen annotation
new ExampleV2().start(mashe);// Post an event
mashe.fire(new ExampleEvent());
}
}public class ExampleV2 {
public void start(Mashe mashe) {
mashe.register(this);
}@Listen
public void onExampleEvent(ExampleEvent event) {
System.out.println("Hello World with annotations!");
}
}public class ExampleEvent extends Event {
// ...
}
```## Imports
With [jitpack](https://jitpack.io/#xHyroM/mashe)
> You can also use github packages but you need have github personal token### Maven
```xml
jitpack.io
https://jitpack.io
com.github.xHyroM
mashe
v0.1.1```
### Gradle
```groovy
repositories {
maven { url 'https://jitpack.io' }
}dependencies {
implementation 'com.github.xHyroM:mashe:v0.1.1'
}
```