Skip to content

Instantly share code, notes, and snippets.

@kaushikgopal
Created June 26, 2016 05:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaushikgopal/cf3b5ebac5380632999d4c648fa359a0 to your computer and use it in GitHub Desktop.
Save kaushikgopal/cf3b5ebac5380632999d4c648fa359a0 to your computer and use it in GitHub Desktop.
Blog post snippet
// don't start emitting items just yet by turning the observable to a connected one
ConnectableObservable<Object> tapEventEmitter = _rxBus.toObserverable().publish();
tapEventEmitter.publish((Func1) (stream) -> {
// inside `publish`, "stream" is truly multicasted
// applying the same technique for getting a debounced buffer sequence
return stream.buffer(stream.debounce(1, TimeUnit.SECONDS));
}).subscribe((Action1) (taps) {
_showTapCount(taps.size());
});
// start listening to events now
tapEventEmitter.connect();
@jemshit
Copy link

jemshit commented Sep 22, 2017

operatorCeption :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment