Throughout this chapter, we've been subscribing and unsubscribing to Observables a lot. Although we know what disposables are, we haven't talked about what different types of disposable classes are available out of the box in RxPHP.
We're not going to write examples for each one of them, because these are very simple classes and if you're not sure about their implementation details, feel free to check their source code.
BinaryDisposable
: A class internally containing two more disposable objects. Then by calling itsdispose()
it automatically callsdispose()
on the two internal disposables as well.CallbackDisposable
: This class wraps a callable that is executed later when callingdispose()
.CompositeDisposable
: A collection of disposables that'll be disposed all together.EmptyDisposable
: A dummy disposable that does nothing. Sometimes it's required to pass or return an instance ofDisposableInterface
even when we have nothing to dispose.RefCountDisposable
: A...