微信小程序选项卡功能开发步骤与方法全解析
891
2022-10-28
lotus是Android中视图之间互相交流的框架
Lotus
Features
Observers have life-cycle attributes Observers bind lifecycle owner(Activity/Fragment) with an API. Lifecycle-aware components perform actions in response to a change in the lifecycle status of another component, such as activities and fragments.
Single Data pool Lotus uses the single data pool for dispatching data and it can handle cross-module interaction perfectly.
Notify events more efficiently Lotus only notify events to the observers which subscribe the event.
Support Mutex observer The Data with a type(DataReactType) can hold one mutex observer.
Support Annotation Write the code with @DataSubscribe annotation to your subscriber methods. The performance can be improved greatly by indexing in build time than reflection in run time.
Compatible without lifecycle Lotus provides api for observes without lifecycle.
Click for Chinese-README
Getting started
Define event type in DataReactType class:
public static final String LOGIN_SUCCESS = "type_1"
Declare subscribers:
@DataSubscribe(dataType ={DataReactType.LOGIN_SUCCESS}) public void onLoginSuccess(Data data) { //do something Log.e(TAG, "get data:" + data.getData()); }
Set data:
DataReact.set(new Data(DataReactType.LOGIN_SUCCESS).setData(userInfo));
License
Copyright (C) 2018 iQIYI.com
Lotus binaries and source code can be used according to the Apache License, Version 2.0.
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~