-
Notifications
You must be signed in to change notification settings - Fork 0
Async
Roman Makeev edited this page Apr 24, 2023
·
1 revision
This package allows you to handle dispatchers and coroutine scope. It contains:
Is like ViewModel from Android - you can launch coroutines from it, you can close it
class MyCustomScope: AsyncComponent {
fun launch() = componentScope.launch {
println("I'm launched in scope: $this!")
}
}It will help you to create custom dispatchers for your Minecraft plugin/library/mod
// Use like this to implement your own dispatchers
class MyDispatchers: KotlinDispatchers { ... }
// Or use this to have default
// KDispatchers is an object implementation
class MyClass(dispatchers: KotlinDispatchers = KDispatchers) { ... }This is UnsafeApi global object of AsyncComponent
fun launchGlobal() {
PluginScope.launch { println("Hello World!") }
}