moko-resources icon indicating copy to clipboard operation
moko-resources copied to clipboard

Issue with JS target and coroutines

Open trentkan opened this issue 2 years ago • 0 comments

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!

trentkan avatar Nov 01 '23 23:11 trentkan