TinyEventBus
TinyEventBus copied to clipboard
Tiny and fast pubsub implementation with subscriber priorities and event canceling for Java 8, 11 and 17.
TinyEventBus
Tiny and fast pubsub implementation with subscriber priorities and event canceling for Java 8, 11 and 17.
usage
void run() {
Bus bus = new Bus();
bus.reg(Sub.of(String.class, System.out::println));
bus.pub("Hello World!");
}
class Listenable {
Sub<Long> sub = Sub.of(Long.class, l -> Foo.bar(l));
void run() {
Bus bus = new Bus();
bus.reg(this);
bus.pub(42L);
}
}
For more explanation, check the example .