
Lightweight signal abstraction for emitting typed events and connecting synchronous handlers. Includes connection handles and a global named-signal registry for simple, minimal event routing.
= emKt — A lightweight Kotlin Multiplatform Signal library :toc: left :toclevels: 3 :source-highlighter: highlightjs :icons: font
A small, idiomatic Kotlin Multiplatform library that provides a Signal abstraction for emitting typed events and connecting handlers across platforms (JVM, Android, JS, WASM, Native).
== Overview
emKt offers a minimal signaling utility inspired by Godot's signals. It is implemented with a small, platform-agnostic API that makes it easy to emit values and connect synchronous handlers.
Key concepts:
T.
Signal.connect().== Features
== Quick start
=== Add the dependency
emKt is configured for Maven Central publishing in this template. Replace
<version> with the current release (check repository tags/releases):
== API examples
Below are common usage patterns. Import the package by adding the following
import in your Kotlin files: import xyz.malefic.emkt.*
=== Basic Signal usage
// Create or retrieve a named Signal (type parameter defines the payload type) val signal = Signals.register("mySignal")
// Connect a synchronous handler. Returns a Connection which can be disconnected val conn = signal.connect { value -> println("Received: $value") }
// Emit values synchronously to all connected handlers signal.emit("hello")
=== Multiple handlers and clearing signals
val s = Signals.register("counter") val a = s.connect { v -> println("A: $v") } val b = s.connect { v -> println("B: $v") }
s.emit(1)
// Disconnect individual connections a.disconnect()
== Design notes
emit().Signals provides a simple global registry useful for application-level
event routing. Call Signals.clear() in tests or when you want to drop all
registrations.== Building & testing
Prerequisites:
Build the library (all targets configured in this repo):
Run the library tests (common tests plus platform tests as configured):
Generate Dokka documentation:
== Publishing
This repository includes a pre-configured publishing setup. See library/build.gradle.kts
and gradle.properties for coordinates and signing configuration. To publish
manually (local or to Maven Central when credentials are set):
For automated publishing the project expects GitHub Secrets for GPG and Sonatype
credentials — see gradle.properties and repository workflows for details.
== Contributing
Contributions are welcome. Suggested workflow:
Please follow Kotlin style and keep changes focused and tested.
== License
This project is published under the MIT License — see the LICENSE file for details.
== Contact / Maintainer
Maintainer: Om Gupta (OmyDaGreat) — ogupta4242@gmail.com
= emKt — A lightweight Kotlin Multiplatform Signal library :toc: left :toclevels: 3 :source-highlighter: highlightjs :icons: font
A small, idiomatic Kotlin Multiplatform library that provides a Signal abstraction for emitting typed events and connecting handlers across platforms (JVM, Android, JS, WASM, Native).
== Overview
emKt offers a minimal signaling utility inspired by Godot's signals. It is implemented with a small, platform-agnostic API that makes it easy to emit values and connect synchronous handlers.
Key concepts:
T.
Signal.connect().== Features
== Quick start
=== Add the dependency
emKt is configured for Maven Central publishing in this template. Replace
<version> with the current release (check repository tags/releases):
== API examples
Below are common usage patterns. Import the package by adding the following
import in your Kotlin files: import xyz.malefic.emkt.*
=== Basic Signal usage
// Create or retrieve a named Signal (type parameter defines the payload type) val signal = Signals.register("mySignal")
// Connect a synchronous handler. Returns a Connection which can be disconnected val conn = signal.connect { value -> println("Received: $value") }
// Emit values synchronously to all connected handlers signal.emit("hello")
=== Multiple handlers and clearing signals
val s = Signals.register("counter") val a = s.connect { v -> println("A: $v") } val b = s.connect { v -> println("B: $v") }
s.emit(1)
// Disconnect individual connections a.disconnect()
== Design notes
emit().Signals provides a simple global registry useful for application-level
event routing. Call Signals.clear() in tests or when you want to drop all
registrations.== Building & testing
Prerequisites:
Build the library (all targets configured in this repo):
Run the library tests (common tests plus platform tests as configured):
Generate Dokka documentation:
== Publishing
This repository includes a pre-configured publishing setup. See library/build.gradle.kts
and gradle.properties for coordinates and signing configuration. To publish
manually (local or to Maven Central when credentials are set):
For automated publishing the project expects GitHub Secrets for GPG and Sonatype
credentials — see gradle.properties and repository workflows for details.
== Contributing
Contributions are welcome. Suggested workflow:
Please follow Kotlin style and keep changes focused and tested.
== License
This project is published under the MIT License — see the LICENSE file for details.
== Contact / Maintainer
Maintainer: Om Gupta (OmyDaGreat) — ogupta4242@gmail.com