Skip to content

JacquesSmuts/RxHelpers

Repository files navigation

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)

About

Extension functions and delegates for RxJava

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages