I have created a kotlin multi-platform library to design Domain layer that targets JVM and JS (nodejs and browser). Domain depends on UseCase, UseCase depends on Repository, Repository depends on Service and Database. AFAIK, Kotlin Coroutines work across platforms (JS/JVM/Native).
I have a function that returns Flow
, instead of Promise
.
fun getUserList() : Flow<List<User>>{...}
Reason is, I want to update UI as soon as there is any change in Database. On JVM (or Android), I know how to consume Flow. But don’t understand how to consume it from plain Javascript(or TypeScript) (not Kotlin-JS). Even I didn’t find any supporting article that explains about using Flow for JS.
Can anyone help me out with this? Any help will be appreciated!
PS: My Javascript Skills are intermediate