moko-resources
moko-resources copied to clipboard
Issue with JS target and coroutines
I have a JS example that is giving me some issues:
Suspend function 'getOrLoad' should be called only from a coroutine or another suspend function
from the code:
@Test
fun t1() {
val stringProvider = SharedResources.stringsLoader.getOrLoad();
val text = getTranslation(SharedResources.strings.hello_world).localized(stringProvider)
assertEquals("Hola", text)
}
Same thing also occurs for using localized in commonMain.
From the README, I noticed we had to provide the stringProvider to the localized function. However, I'm getting the above issue and not sure how to solve.
Thanks!