Skip to content

Instantly share code, notes, and snippets.

@tanmatra
Created May 13, 2021 16:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tanmatra/e383d40dcabe2b90000b3b5a9ecb5cfd to your computer and use it in GitHub Desktop.
Save tanmatra/e383d40dcabe2b90000b3b5a9ecb5cfd to your computer and use it in GitHub Desktop.
IDEA with Kotlin plugin freeze
package example
class DataChannel {
fun registerObserver(dataChannelObserver: DataChannelObserver?) {}
}
interface DataChannelObserver {
fun onStateChange()
}
class Player
{
suspend fun startAsync(dataChannel: DataChannel) {
dataChannel.registerObserver(object : DataChannelObserver {
override fun onStateChange() {
println("onStateChange: $") // place cursor after $ and type {
}
})
println("Observer registered: ${dataChannel.toString()}") // .toString() here is intentional
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment