KDispatcher alternatives and similar libraries
Based on the "Misc" category.
Alternatively, view KDispatcher alternatives based on common mentions on social networks and blogs.
-
jclasslib
jclasslib bytecode editor is a tool that visualizes all aspects of compiled Java class files and the contained bytecode. -
kotlin-logging
Lightweight Multiplatform logging framework for Kotlin. A convenient and performant logging facade. -
kotlin-telegram-bot
๐ค A wrapper for the Telegram Bot API written in Kotlin -
kotlinx.atomicfu
The idiomatic way to use atomic operations in Kotlin -
tinylog
tinylog is a lightweight logging framework for Java, Kotlin, Scala, and Android -
lingua
The most accurate natural language detection library for Java and the JVM, suitable for long and short text alike -
Kotlift
Kotlift is the first source-to-source language transpiler from Kotlin to Swift -
kotlinx.reflect.lite
Lightweight library allowing to introspect basic stuff about Kotlin symbols -
Humanizer.jvm
Humanizer.jvm meets all your jvm needs for manipulating and displaying strings, enums, dates, times, timespans, numbers and quantities. -
actions-on-google-kotlin
Unofficial Actions on Google SDK for Kotlin and Java -
klutter
A mix of random small libraries for Kotlin, the smallest reside here until big enough for their own repository. -
solr-undertow
Solr / SolrCloud running in high performance server - tiny, fast startup, simple to configure, easy deployment without an application server. -
kassava
This library provides some useful kotlin extension functions for implementing toString(), hashCode() and equals() without all of the boilerplate. -
SimpleDNN
SimpleDNN is a machine learning lightweight open-source library written in Kotlin designed to support relevant neural network architectures in natural language processing tasks -
units-of-measure
Type-safe dimensional analysis and unit conversion in Kotlin. -
kotlin-futures
A collections of extension functions to make the JVM Future, CompletableFuture, ListenableFuture API more functional and Kotlin like. -
TLSLibrary
Simple TlsLibrary written in Kotlin - Provides DSL for creating TLS connections -
scientist
A kotlin library for refactoring code. Port of GitHub's scientist. -
kasechange
๐ซ๐๐ข๐ ฟ Multiplatform Kotlin library to convert strings between various case formats including Camel Case, Snake Case, Pascal Case and Kebab Case -
kjob
A lightweight coroutine based persistent job/cron scheduler written in Kotlin -
PrimeCalendar
PrimeCalendar provides all of the java.util.Calendar functionalities for Persian, Hijri, and ... dates. It is also possible to convert dates to each other. -
kotlin-pluralizer
:sunny: Kotlin extension to pluralize and singularize strings -
kformula
Mathematical expression engine written in Kotlin, running on JVM. -
kase-format
Multiplatform kotlin string case conversion and detection library.
Appwrite - The Open Source Firebase alternative introduces iOS support
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of KDispatcher or a related project?
README
KDispatcher is a Kotlin EventDispatcher
This is light-weight event dispatcher based on KOTLIN
priority: Int? = null
to subscribe function for sorting- Inline function Included
You can subscribe on event by calling:
val EVENT_CALL_ONE = "simple_event_name"
val eventListener = ::eventHandler
val priority = 1
KDispatcher.subscribe(EVENT_CALL_ONE, eventListener, priority)
where:
- EVENT_CALL_ONE - simple event type
- eventListener - function listener for event
- priority - the priority to sort calling functions
/**
* notif:Notification<T:Any> - event holder object that store
* data:T? = null - can be any type of data
* eventName:String? = null - current event type
* cause u may have more then one EVENT_TYPE for current event listener
*/
fun eventHandler(notif:Notification<Any>){
when(notif.eventName){
EVENT_CALL_ONE -> println("FIRST EVENT")
}
}
Of course u can simpe call the event for all listeners by
val test:MyTestClass = MyTestClass()
KDispatcher.call(EVENT_CALL_ONE, test)
Don't forget to unsubscribe your listeners when u dont need it anymore.
KDispatcher.unsubscribe(EVENT_CALL_ONE, eventListener)
Sinse version 0.1.2 you can use extension and inline functions of KDispatcher. All you need to do is implement IKDispatcher
interface. Also you can use single lambda functions like (Notification<T:Any>) -> Unit
as event handlers
class MainActivity : AppCompatActivity(), IKDispatcher {
private val eventListenerOne = this::eventOneHandler
//...
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
scopeOperation()
}
private fun scopeOperation() {
// subscribe event to this handlers
subscribe(EVENT_CALL_ONE, eventListenerOne, 3)
subscribe(EVENT_CALL_ONE, ::eventListenerTwo, 1)
subscribe(EVENT_CALL_ONE, MyClass::eventListenerFour, 2)
// call event
call(EVENT_CALL_ONE, "FIRST CALL FROM KDISPATCHER")
/**
* But you can simple use inner lambda function to handler notification.
* So as u hasn't a reference to ISubscriber handler function, when you call
* `usubscribe(String)` you will delete all references ISubscriber-listener
*/
val eventName = "LAMBDA_EVENT"
subscribe<String>(eventName) { notification ->
println("LAMBDA_EVENT HAS FIRED with event name ${notification.eventName} and data ${notification.data}")
unsubscribe(notification.eventName)
}
call(eventName, "FIRST CALL CUSTOM LABDA EVENT")
/**
* Since version 0.1.7 you can subscribe by scope of events by a single callback
*/
subscribeList<Any>(listOf("notif_one", "notif_two")) {
when(it.eventName) {
"notif_one" -> Toast.makeText(this, "This is notif_one", Toast.LENGTH_SHORT).show()
"notif_two" -> Toast.makeText(this, "This is notif_two", Toast.LENGTH_SHORT).show()
}
}
call("notif_one")
call("notif_two")
}
fun eventOneHandler(notification:Notification<Any>) {
println("eventOneHandler MY TEST IS COMING event = ${notification.eventName} AND data = ${notification.data}")
}
}
Gradle:
implementation 'com.rasalexman.kdispatcher:kdispatcher:x.y.z'
Maven:
<dependency>
<groupId>com.rasalexman.kdispatcher</groupId>
<artifactId>kdispatcher</artifactId>
<version>x.y.z</version>
<type>pom</type>
</dependency>
- ThreadSafe
- Simple
- Usefull
License
MIT License
Copyright (c) 2019 Alexandr Minkin ([email protected])
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*Note that all licence references and agreements mentioned in the KDispatcher README section above
are relevant to that project's source code only.