# ModuleBus **Repository Path**: newwwcom/ModuleBus ## Basic Information - **Project Name**: ModuleBus - **Description**: No description available - **Primary Language**: Android - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-06-29 - **Last Updated**: 2021-11-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # ModuleBus Module Bus is use for diffent modules communication.
ModuleBus in 3 steps ------------------- 1. Define events: ```java public static class MessageClient extend IBaseClient { /* Additional fields if needed */ } ``` 2. Prepare ModuleEvent and function: Declare and annotate your subscribing method.
```java @ModuleEvent(coreClientClass = MessageClient.Class) public void fun(Object...args) {/* Do something */}; ``` Register and unregister your ModuleBus. For example on Android, activities and fragments should usually register according to their life cycle: ```java @Override public void onStart() { super.onStart(); ModuleBus.getInstance().register(this); } @Override public void onDestroy() { super.onStop(); ModuleBus.getInstance().unregister(this); } ``` 3. Post function: ```java ModuleBus.getInstance().post(MessageClient.class,"fun",Object...args); ``` Add ModuleBus to your project ---------------------------- Gradle: ```gradle compile 'com.cangwang.core:modulebus:2.0.0' ``` Maven: ```xml com.cangwang.core modulebus 2.0.0 pom ``` *Important
need to set base module depend with ModuleBus and ,other communicated modules depend with base module. *2016.12.12 update
(1)Use ArrayMap to change with HashMap.
(2)Add startModuleActivity function.
(3)Fix bugs and develop speeds in ModuleBus.
*2017.2.27 update
(1) Add Module architecture inclue activity,fragment and view.
(2) Add Application util ModuleImpl.
*2017.3.3 update moduleBus 2.0.0
(1) update Module architecture inclue activity,fragment and view.