SpotiFlyer/web-app/src/main/kotlin/client.kt

38 lines
1.1 KiB
Kotlin
Raw Normal View History

import co.touchlab.kermit.Kermit
import com.shabinder.common.di.Dir
import com.shabinder.common.di.FetchPlatformQueryResult
import com.shabinder.common.di.initKoin
2021-03-06 20:20:07 +01:00
import react.dom.render
import kotlinx.browser.document
import kotlinx.browser.window
2021-03-12 21:18:03 +01:00
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import org.koin.core.component.KoinComponent
import org.koin.core.component.get
2021-03-06 20:20:07 +01:00
fun main() {
window.onload = {
render(document.getElementById("root")) {
2021-03-12 21:18:03 +01:00
App {
dependencies = AppDependencies
2021-03-06 20:20:07 +01:00
}
}
}
}
object AppDependencies : KoinComponent {
2021-03-12 21:18:03 +01:00
val appScope = CoroutineScope(Dispatchers.Default)
val logger: Kermit
val directories: Dir
val fetchPlatformQueryResult: FetchPlatformQueryResult
init {
initKoin()
directories = get()
logger = get()
fetchPlatformQueryResult = get()
2021-03-12 21:18:03 +01:00
appScope.launch {
//fetchPlatformQueryResult.spotifyProvider.authenticateSpotifyClient(true)
}
}
2021-03-06 20:20:07 +01:00
}