|
|
|
|
|
by typpytyper
3618 days ago
|
|
logger.info("...");
versus: EventHandle eh = EBus.getHandle(
eventBuilder.executing().name("some operation").build());
if (eh.isAllowed()) {
eh.addParam("p1","v1").addParam("p2","v2").post();
}
That's a lot of typing.It needs a more compact API. |
|
There are more established event buses in Android with simpler syntax, like greenrobot's: EventBus.getInstance().post(new LogEvent("v1", "v2"));
Seen here: http://greenrobot.org/eventbus/documentation/how-to-get-star...
You can have multiple event buses and other customization there as needed, but you have sensible defaults to keep code small most of the time too.
Square also has one called Otto. If you want a lot of syntax and Java rather than Android, you might as well go full streaming with the RxJava library.