Skip to content

dsl: add Kotlin bus extensions #6

Description

@lambdagg

We might need something like:

import wtf.mizu.kawa.OptimizedBus

fun main() {
    val bus = OptimizedBus()

    bus.addListener { 
        on<String> {
            println(it)
        }
    }

    val event = "foobar123"
    bus.publish(event)
}

and

import wtf.mizu.kawa.OptimizedBus

fun main() {
    val bus = OptimizedBus()

    bus.addListener<String> { 
        println(it)
    }

    val event = "foobar123"
    bus.publish(event)
}

or name the function whatever we want, like buildListener as @xtrm-en told me but that wouldn't really make sense as we're not only building it but also adding it directly.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions