Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

一种更加简化的无入侵的 LiveData 非粘性数据解决方案 #33

Open
groooooomit opened this issue Jul 31, 2022 · 2 comments
Labels

Comments

@groooooomit
Copy link

UnPeekLiveData 有个不适用的场景:不能利用官方的 map、filter 等方法进行变换,变换后变为了普通的 LiveData

解决方案详见 livedata-no-sticky

@KunMinX
Copy link
Owner

KunMinX commented Jul 31, 2022

感谢你的分享。可否这么理解,如欲支持 map filter,只能通过 kotlin 拓展函数对 LiveData 直接进行拓展 …
如此使用场景便也不便用于 java …

目前我们是将 UnPeekLiveData 视作领域层消息回推用途,故基于单一职责原则,默认原本也是不考虑使用 map filter 等过度设计功能(它们应当由 kotlin flow 或 rxjava 完成)

最后,此处保持本分享 open,供后来者参考。

@groooooomit
Copy link
Author

嗯嗯,UnPeekLiveData java 中也用蛮久了,kotlin 中 StateFlow 是趋势了。这里作为「粘性数据」问题的一种解决思路补充

@KunMinX KunMinX added 精华 and removed 讨论中 labels Aug 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants