reactfx/src/main/java/org/reactfx/EventStreams.java
public static EventStream<?> restartableTicks(Duration interval, EventStream<?> impulse) {
        return new EventStreamBase<Void>() {
            private final Timer timer = FxTimer.createPeriodic(
                    interval, () -> emit(null));

            @Override
            protected Subscription observeInputs() {
                timer.restart();
                return Subscription.multi(
                        impulse.subscribe(x -> timer.restart()),
                        timer::stop
                );
            }
        };
    }
public static EventStream<?> restartableTicks(Duration interval, EventStream<?> impulse) {
        return new EventStreamBase<Void>() {
            private final Timer timer = FxTimer.createPeriodic(
                    interval, () -> emit(null));

            @Override
            protected Subscription observeInputs() {
                timer.restart();
                return Subscription.multi(
                        impulse.subscribe(x -> timer.restart()),
                        timer::stop
                );
            }
        };
    }
Returns a {@link #ticks(Duration)} EventStream whose timer restarts whenever
impulse emits an event.
@param interval - the amount of time that passes until this stream emits its next tick
@param impulse - the EventStream that resets this EventStream's internal timer