org.reactfx.ForgetfulEventStream Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of reactfx Show documentation
Show all versions of reactfx Show documentation
Reactive event streams for JavaFX
package org.reactfx;
class ForgetfulEventStream extends SuspendableEventStreamBase {
private boolean hasValue = false;
private T value = null;
ForgetfulEventStream(EventStream source) {
super(source);
}
@Override
protected void handleEventWhenSuspended(T event) {
value = event;
hasValue = true;
}
@Override
protected void onResume() {
if(hasValue) {
T toEmit = value;
reset();
emit(toEmit);
}
}
@Override
protected void reset() {
hasValue = false;
value = null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy