The following is my series of related articles, interested can refer to, you can give a like or follow my article.


How to make an app with a crash rate less than 3/1000 – chapter list


In the previous article, many students feedback that I want to do an example for learning.
Recently, IN my spare time, I built an open source framework for multi-module interaction called ModuleBus.
The fundamental principles of cross-Module interaction are described in detail in section 7 of Cross-Module interaction
(The temporary example is still relatively simple state, will be improved later, please do not take offense oh)


ModuleBus address

I’ve uploaded it to Github, and the usage is as close to EventBus as possible, just so you’re familiar with it. It’s about 54K in size without any compression.

It’s been uploaded to JCenter, so you can call it directly


Just a quick introduction
You need to define your own Client for transport, which inherits from IBaseClient
Then the ModuleEvent’s coreClientClass is used to specify the corresponding Client, and the implementation method is added with any method name.
The methods for registering and unregistering are the same as for EventBus
For the post method, set the first parameter to client.class, the second parameter to the method name, and the following parameters to the method parameters.


In this case, we need to add the moduleBus dependency to the base module, and then other modules that need to be interacted with depend on base.
Examples will have a simple demonstration, as long as the download can see the source code and call. I’ll also encapsulate features that are getting better and better.
If you think it’ll help, please give me one
Lot of star
oh


If you have any source code problems or more requirements communication, you can also reply here.
That’s all for this section.
Stay tuned for the next section!!