Tencent / MMKV

An efficient, small mobile key-value storage framework developed by WeChat. Works on Android, iOS, macOS, Windows, and POSIX.
Other
17.43k stars 1.91k forks source link

registerOnSharedPreferenceChangeListener not support #49

Closed zaijie1213 closed 6 years ago

zaijie1213 commented 6 years ago

The language of MMKV

e.g. Objective-C, Swift, Java, or Kotlin java

The version of MMKV

e.g. v1.0.10

v1.0.10

The platform of MMKV

e.g. iOS or Android

Android

The installation of MMKV

e.g. Cocoapods, Carthage, Maven, AAR Package or Git clone

What's the issue?

Post the outputs or screenshots for errors. registerOnSharedPreferenceChangeListener And unregisterOnSharedPreferenceChangeListener not suport Explain what you want by example or code in English.

OnSharedPreferenceChangeListener Is a very common and important API

lingol commented 6 years ago

Data-change-listener is not supported by design. We suggest using something like event-bus to notify any interesting clients. Doing this inside a storage framework smells really bad.

kadaluarsa commented 3 years ago

Data-change-listener is not supported by design. We suggest using something like event-bus to notify any interesting clients. Doing this inside a storage framework smells really bad.

how to use with eventbus when we don't have any callback from the value changes?

lingol commented 3 years ago

Data-change-listener is not supported by design. We suggest using something like event-bus to notify any interesting clients. Doing this inside a storage framework smells really bad.

how to use with eventbus when we don't have any callback from the value changes?

Whoever makes the change should notify any interesting partners, if any changes on that specific key are meant to be heard. MMKV, as a fundament KV storage framework, chooses not to take that responsibilty.