SwiftEventBus icon indicating copy to clipboard operation
SwiftEventBus copied to clipboard

How to send sticky events?

Open chanonly123 opened this issue 7 years ago • 6 comments

chanonly123 avatar Oct 09 '17 07:10 chanonly123

+1

Blankeer avatar Mar 23 '18 08:03 Blankeer

post sticky is very useful plz add it

hamedsilver avatar Nov 29 '18 10:11 hamedsilver

I don't have the time right now, can you please open a pull request?

cesarferreira avatar Nov 29 '18 11:11 cesarferreira

@cesarferreira can you give a hint about the best way to add it to SwiftEventBus ? I will work on adding it

iballan avatar Apr 03 '19 15:04 iballan

Some events carry information that is of interest after the event is posted. For example, an event signals 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. So EventBus keeps the last sticky event of a certain type in memory. Then the sticky event can be delivered to subscribers or queried explicitly. Thus, you don’t need any special logic to consider already available data

hamedsilver avatar Apr 03 '19 20:04 hamedsilver

You can see the java eventbus in this link : http://greenrobot.org/eventbus/documentation/configuration/sticky-events/

hamedsilver avatar Apr 03 '19 20:04 hamedsilver