russhwolf / multiplatform-settings

A Kotlin Multiplatform library for saving simple key-value data
Apache License 2.0
1.69k stars 67 forks source link

Cannot access class 'org.w3c.dom.Storage' #209

Open GuilhE opened 1 month ago

GuilhE commented 1 month ago

This error was throwing in this configuration, for StorageSettings:

actual class PlatformDependencies actual constructor() {
    actual fun getSettings(): Settings = StorageSettings()
}

The issue was resolved by adding the kotlinx-browser dependency to the wasmJsMain target in the shared module. Is this something users need to handle in their projects, or could multiplatform-settings address it internally? It might also be worth mentioning in the README.md.

Thanks.

russhwolf commented 3 weeks ago

The sample app doesn't include kotlinx-browser and builds/runs fine as far as I'm aware. Can you link a project that reproduces the issue?

GuilhE commented 3 weeks ago

Yes, check this sample https://github.com/GuilhE/WhosNext, also this commit

russhwolf commented 2 weeks ago

Ok I see. The APIs were removed from the wasm stdlib in 2.1.0-Beta2 which I hadn't gotten around to testing against. I'll add the dependency in the next release.