Closed xvadim closed 5 years ago
good point, thanks for an issue report.
But I really wouldn't like to break promise flow there and add some special type of Consumer
.
The proposition:
GdxFIRDatabase.inst()
.inReference("something")
.onDataChange(List.class, ChangeBehaviour.ADDED, ChangeBehaviour.REMOVED...)
.then(...)
Maybe something like that should do the trick, what do you think? The ChangeBehaviour
varargs argument will be optional.
Hi, your proposition looks good.
Btw, is your email still the same: git@mk5.pl ?
yes, git@mk5.pl is a valid email.
Okay, so that will be next feature - I'll do that soon
hello, I'm back with good news. Please check the latest 2.1.0
version, I've added brand new onChildChange
method to the API.
Example of usage:
GdxFIRDatabase.inst()
.inReference("users")
.onChildChange(List.class, ChildEventType.ADDED, ChildEventType.REMOVED)
.then(new Consumer<List<User>>() {
@Override
@MapConversion(User.class)
public void accept(List<User> user) {
}
})
Thanks a lot! Will try.
It works! Thanks a lot!
It would be nice to have a special method for list events, i.e. support of ChildEventListener. It will allow don't read a full object via the method onDataChange, but just only newly added (or changed) data.
In this case code may look like this (in this example turns is a list of all players' turns during a game):