Motivation
Starting in recent versions, Google has released Web-compatible artifacts for Jetpack DataStore:
androidx.datastore:datastore-core-wasm-js
androidx.datastore:datastore-preferences-core-wasm-js
androidx.datastore:datastore-core-okio-wasm-js (likely using Okio for cross-platform IO)
Currently, the multiplatform-settings-datastore module is restricted to non web platforms. However, since the underlying DataStore library now supports Web (via Okio/Wasm), multiplatform-settings should be able to expose this functionality.
Proposed Solution
I propose updating the multiplatform-settings-datastore module to include JS and Wasm targets.
Since multiplatform-settings acts as a wrapper around androidx.datastore, it should be sufficient to:
- Add the
wasm-js and js artifacts from the androidx.datastore ecosystem to the module's dependencies.
- Ensure the backend configuration allows these targets to use the Okio-based implementation.
This would allow Web developers to use the type-safe ProtoBuf API of DataStore, just like Android/iOS and Desktop developers, without needing to switch to the basic Key-Value preferences module.
Why this is needed
Web developers currently lose the benefits of Protocol Buffers and Flow-based reactive streams when using multiplatform-settings. By leveraging the new Google Web artifacts, we can provide a consistent API across all platforms (Android, iOS, Desktop, Web).
Additional context
If the current implementation relies on file-based storage, the new okio-wasm-js artifacts seem to provide the necessary abstraction to make this work on Web (likely mapping to IndexedDB).
Motivation
Starting in recent versions, Google has released Web-compatible artifacts for Jetpack DataStore:
androidx.datastore:datastore-core-wasm-jsandroidx.datastore:datastore-preferences-core-wasm-jsandroidx.datastore:datastore-core-okio-wasm-js(likely using Okio for cross-platform IO)Currently, the
multiplatform-settings-datastoremodule is restricted to non web platforms. However, since the underlying DataStore library now supports Web (via Okio/Wasm),multiplatform-settingsshould be able to expose this functionality.Proposed Solution
I propose updating the
multiplatform-settings-datastoremodule to include JS and Wasm targets.Since
multiplatform-settingsacts as a wrapper aroundandroidx.datastore, it should be sufficient to:wasm-jsandjsartifacts from theandroidx.datastoreecosystem to the module's dependencies.This would allow Web developers to use the type-safe ProtoBuf API of DataStore, just like Android/iOS and Desktop developers, without needing to switch to the basic Key-Value
preferencesmodule.Why this is needed
Web developers currently lose the benefits of Protocol Buffers and
Flow-based reactive streams when usingmultiplatform-settings. By leveraging the new Google Web artifacts, we can provide a consistent API across all platforms (Android, iOS, Desktop, Web).Additional context
If the current implementation relies on file-based storage, the new
okio-wasm-jsartifacts seem to provide the necessary abstraction to make this work on Web (likely mapping to IndexedDB).