SkillAgentSearch skills...

Eemit

Tiny event emitter library for Java

Install / Use

/learn @h2337/Eemit
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

eemit

eemit is a Java event emitter library. It lets you emit objects (from multiple places) of the specified type in a given channel and handle them elsewhere in code by subscribing to that channel.

Install

Maven:

<dependency>
    <groupId>com.github.h2337</groupId>
    <artifactId>eemit</artifactId>
    <version>0.1.0</version>
</dependency>

Gradle:

implementation 'com.github.h2337:eemit:0.1.0'

Usage

import io.github.h2337.eemit.EventEmitter;

...

// Create EventEmitter with any type as an event type, here just String
EventEmitter<String> emitter = new EventEmitter<>();

// Listen to events on channel "channel666", pass in a lambda that'll receive channel name and the event object
emitter.on("channel666", (channel, object) -> {
  // Do something with object (which is String because we parameterized EventEmitter with String)
  // "channel" argument will either be "channel666" or "*" here
});

// Listen to events on all channels
emitter.on("*", (channel, object) -> {
  // Do something with object
});

// Emit an event on "channel666", second parameter is of type that you parameterized EventEmitter with
emitter.emit("channel666", "Some string");

// Emit to all channels
emitter.emit("*", "Some string");

// How to unlisten:
String uuid = emitter.on("channel666", (channel, object) -> {
  // Do something with object
});
// Unregister callback
emitter.off(uuid);
View on GitHub
GitHub Stars22
CategoryDevelopment
Updated6mo ago
Forks2

Languages

Java

Security Score

87/100

Audited on Sep 22, 2025

No findings