blob: dc6e194b534c61b5391fe05c96fc74636cbb0bd9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
import me.bush.illnamethislater.*
import org.apache.logging.log4j.Level
import org.apache.logging.log4j.LogManager
import org.apache.logging.log4j.core.config.Configurator
/**
* @author bush
* @since 1.0.0
*/
fun main() {
Configurator.setRootLevel(Level.INFO)
// EventBus().run {
//
// subscribe(Subscriber())
//
// post("String")
//
// val key = register(listener<Int> {
// println(it)
// })
//
// val topLevelListenerKey = register(topLevelListener())
//
// unsubscribe(key)
//
// unsubscribe(topLevelListenerKey)
//
// debugInfo()
// }
val not = NotDuck()
not.wtf()
doDuck(not)
//doDuck(Any())
}
fun topLevelListener() = listener<Int> { println("topLevelListener(): $it") }
class Subscriber {
val listener0 get() = listener<String>(500, true, false) {
println(it.uppercase())
}
}
fun doDuck(any: Any) {
}
class NotDuck {
fun wtf() {
println("wtf")
}
}
interface Duck {
fun wtf()
}
|