Skip to content

3jq/hookdispatcher

Repository files navigation

HookDispatcher - Tiny and fast event dispatcher.

Installation

Gradle

repositories {
    maven { url 'https://jitpack.io' }
}

dependencies {
    implementation 'com.github.3jq:hookdispatcher:1.2'
}

Maven

<repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
</repository>
    
<dependency>
    <groupId>com.github.3jq</groupId>
    <artifactId>hookdispatcher</artifactId>
    <version>1.2</version>
</dependency>

Usage

public class Main {
	public static void main(String[] args) {
		EventDispatcher eventDispatcher = new EventDispatcher();
		eventDispatcher.register(new TestHandler());
		eventDispatcher.post(new TestEvent());
	}

public class TestHandler {
	@Subscribe
	public void onEvent(TestEvent event) {
		System.out.println("Hey, I am working!");
	}
}

public class TestEvent {}

Performance

Since when I was testing, it was doing 1 mil tasks for 7586 millis (the fastest, avg 8966)

About

Tiny and fast event dispatcher.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages