public static < O extends Observable > EventStream < O > repeatOnInvalidation ( O observable ) { return new EventStreamBase < O > ( ) { @ Override protected Subscription observeInputs ( ) { InvalidationListener listener = obs -> emit ( observable ) ; observable . addListener ( listener ) ; return ( ) -> observable . removeListener ( listener ) ; } @ Override protected void newObserver ( Consumer < ? super O > subscriber ) { subscriber . accept ( observable ) ; } } ; }
Creates an event stream that emits the given observable immediately for every subscriber and re - emits it on every subsequent invalidation of the observable .