You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-5Lines changed: 15 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -24,15 +24,15 @@ EventBus is pushed to [Maven Central](http://search.maven.org/#search%7Cga%7C1%7
24
24
Gradle template ([check current version](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22de.greenrobot%22%20AND%20a%3A%22eventbus%22)):
25
25
```
26
26
dependencies {
27
-
compile 'de.greenrobot:eventbus:2.0.2'
27
+
compile 'de.greenrobot:eventbus:2.2.0'
28
28
}
29
29
```
30
30
Maven template ([check current version](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22de.greenrobot%22%20AND%20a%3A%22eventbus%22)):
31
31
```
32
32
<dependency>
33
33
<groupId>de.greenrobot</groupId>
34
34
<artifactId>eventbus</artifactId>
35
-
<version>2.0.2</version>
35
+
<version>2.2.0</version>
36
36
</dependency>
37
37
```
38
38
@@ -48,6 +48,16 @@ In EventBus, each event handling method is associated with a thread mode (have a
48
48
49
49
*Example:* Consider your subscriber updates the UI, but the triggering event is posted by a background thread (using `eventBus.post(event)`). The name of the event handling method should be `onEventMainThread`. EventBus takes care of calling the method in the main thread without any further code required
50
50
51
+
Subscriber priorities and ordered event delivery
52
+
------------------------------------------------
53
+
*TODO. For now, this is just the javadoc for the method register(Object subscriber, int priority):*
54
+
Like register(Object) with an additional subscriber priority to influence the order of event delivery. Within the same delivery thread (ThreadMode), higher priority subscribers will receive events before others with a lower priority. The default priority is 0. Note: the priority does *NOT* affect the order of delivery among subscribers with different ThreadModes!
55
+
56
+
Cancelling further event delivery
57
+
---------------------------------
58
+
*TODO. For now, this is just the javadoc for the method cancelEventDelivery(Object event):*
59
+
Called from a subscriber's event handling method, further event delivery will be canceled. Subsequent subscribers won't receive the event. Events are usually canceled by higher priority subscribers (see register(Object, int)). Canceling is restricted to event handling methods running in posting thread ThreadMode.PostThread.
60
+
51
61
Sticky Events
52
62
-------------
53
63
Some events carry information that is of interest after the event is posted. For example, this could be an event signalizing that some initialization is complete. Or if you have some sensor or location data and you want to hold on the most recent values. Instead of implementing your own caching, you can use sticky events. EventBus keeps the last sticky event of a certain type in memory. The sticky event can be delivered to subscribers or queried explicitly. Thus, you don't need any special logic to consider already available data.
@@ -60,7 +70,7 @@ Additional Features and Notes
60
70
***NOT based on annotations:** Querying annotations are slow on Android, especially before Android 4.0. Have a look at this [Android bug report](http://code.google.com/p/android/issues/detail?id=7811)
61
71
***Based on conventions:** Event handling methods are called "onEvent" (you could supply different names, but this is not encouraged).
62
72
***Performanced optimized:** It's probably the fastest event bus for Android.
63
-
***Tiny:** The jar is less than 30 KBytes.
73
+
***Tiny:** The jar is less than 50 KBytes.
64
74
***Convenience singleton:** You can get a process wide event bus instance by calling EventBus.getDefault(). You can still call new EventBus() to create any number of local busses.
65
75
***Subscriber and event inheritance:** Event handler methods may be defined in super classes, and events are posted to handlers of the event's super classes including any implemented interfaces. For example, subscriber may register to events of the type Object to receive all events posted on the event bus.
66
76
***Selective registration:** It's possible to register only for specific event types. This also allows subscribers to register only some of their event handling methods for main thread event delivery.
0 commit comments