commonMain.dev.icerock.moko.socket.SocketBuilder.kt Maven / Gradle / Ivy
/*
* Copyright 2020 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/
package dev.icerock.moko.socket
interface SocketBuilder {
fun on(event: String, action: Socket.(message: String) -> Unit)
fun on(socketEvent: SocketEvent, action: Socket.(array: T) -> Unit)
fun on(vararg events: String, action: Socket.(message: String) -> Unit) {
events.forEach {
on(it, action)
}
}
fun on(vararg socketEvents: SocketEvent, action: Socket.(array: T) -> Unit) {
socketEvents.forEach {
on(it, action)
}
}
}