Once our setup is done, we are able to start the server and see the login page. It's time to pass the nickname or server and enter the chat room.
We have written a function named onLoginButtonClicked(). The body for this function should like this:
private fun onLoginButtonClicked(): (Event) -> Unit { return { if (!nickName.isBlank()) { val formContainer = document.getElementById("loginDiv") as HTMLDivElement formContainer.remove() callback(nickName) } } }
The preceding function does two special things:
- Smart casting
- Registering a simple callback