Skip to content

Latest commit

 

History

History
49 lines (31 loc) · 2.12 KB

README.md

File metadata and controls

49 lines (31 loc) · 2.12 KB

RxHelpers

Extension functions and delegates for RxJava

CircleCI Download

This app provides a few extension functions and delegates for RxJava in Kotlin

Installation

implementation 'com.jacquessmuts:rxhelpers:{version}'

Usage

Extension Description Example
.filterRapidClicks() Throttles out events within 300ms Example
.subscribeAndLogE{} Same as .subscribe{}, except it logs an error by default. Example
.computationThread() Same as observeOn(Schedulers.computation()) Example
.uiThread() Same as observeOn(AndroidSchedulers.mainThread()) Example
Delegate Description Example
LazyPublishSubject<> Creates a lazy-loaded PublishSubject<> Example

Setting Defaults

You can set the default handling of some functions. Do it in the onCreate of your application.

RxHelper.setDefaultErrorHandling { throwable ->
    // Every time .subscribeAndLogE catches an error, this will run
    Timber.e(throwable)
}

// events faster than 500ms will be filtered out by .filterRapidClick()
RxHelper.setMaximumClickRapidity(500)