File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed
Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change 1+ import kotlinx.coroutines.GlobalScope
2+ import kotlinx.coroutines.flow.collect
3+ import kotlinx.coroutines.launch
4+ import me.moallemi.kmpshowcase.shared.presentation.AppListViewModel
5+ import org.koin.core.KoinComponent
6+ import org.koin.core.inject
7+
8+ class Application : KoinComponent {
9+
10+ private val appListViewModel: AppListViewModel by inject()
11+
12+ fun load (result : (String ) -> Unit ) {
13+ GlobalScope .launch {
14+ appListViewModel.apps.collect {
15+ result(it.toString())
16+ }
17+ }
18+ appListViewModel.load()
19+ }
20+
21+ }
Original file line number Diff line number Diff line change 11import kotlinx.browser.document
2+ import me.moallemi.kmpshowcase.shared.di.initKoinJs
23
34fun main () {
4- document.body?.textContent = " Welcome"
5+ initKoinJs()
6+
7+ val app = Application ()
8+ app.load {
9+ document.body?.textContent = it
10+ }
511}
You can’t perform that action at this time.
0 commit comments