Target filter
Search Kotlin docs
  • Platforms
  • Tealium Prism Kotlin
core/com.tealium.prism.core.api.pubsub/Observables

Observables

object Observables

Factory object for creating common Observable and Subject implementations.

Functions

async
Link copied to clipboard
@JvmStatic
fun <T> async(block: (Observer<T>) -> Disposable): Observable<T>

Returns an observable that emits only when the provided block of code has completed, This block will be executed whenever a new subscription is made.

callback
Link copied to clipboard
@JvmStatic
fun <T> callback(block: (Observer<T>) -> Unit): Observable<T>

Returns an observable that emits only when the provided block of code has completed, This block will be executed whenever a new subscription is made.

combine
Link copied to clipboard
@JvmStatic
fun <T, R> combine(vararg sources: Observable<T>, combiner: (Iterable<T>) -> R): Observable<R>
@JvmStatic
fun <T, R> combine(sources: Iterable<Observable<T>>, combiner: (Iterable<T>) -> R): Observable<R>

Returns an observable that combines the emissions of all sources. The downstream emission is the result of applying the combiner function to the latest emissions of all sources - and are only possible once all sources have emitted at least one value.

@JvmStatic
fun <T1, T2, R> combine(observable1: Observable<T1>, observable2: Observable<T2>, combiner: (T1, T2) -> R): Observable<R>

Returns an observable that combines the emissions of this observable the given other. The downstream emission is the result of applying the combiner function to the latest emissions of both observables - and are only possible once both this and the other have emitted at least one value.

create
Link copied to clipboard
@JvmStatic
fun <T> create(subscriptionHandler: (Observer<T>) -> Disposable): Observable<T>

Used to create a custom Observable implementation whereby the subscriptionHandler will be call upon an Observer subscribing to the returned Observable

empty
Link copied to clipboard
@JvmStatic
fun <T> empty(): Observable<T>

Returns an observable that does not emit anything.

fromIterable
Link copied to clipboard
@JvmStatic
fun <T> fromIterable(items: Iterable<T>): Observable<T>

Returns an observable that emits each item from the given items to any observer that subscribes.

just
Link copied to clipboard
@JvmStatic
fun <T> just(item: T): Observable<T>

Returns an observable that emits only the given item to any observer that subscribes.

@JvmStatic
fun <T> just(vararg items: T): Observable<T>

Returns an observable that emits only the given items to any observer that subscribes.

merge
Link copied to clipboard
@JvmStatic
fun <T> merge(vararg observables: Observable<T>): Observable<T>
@JvmStatic
fun <T> merge(observables: Iterable<Observable<T>>): Observable<T>

Returns an observable that emits all of the source emissions from all of the given observables.

publishSubject
Link copied to clipboard
@JvmStatic
fun <T> publishSubject(): Subject<T>

Returns an observable subject that emits values to any subscribers at the time of the emission.

replaySubject
Link copied to clipboard
@JvmStatic
fun <T> replaySubject(): ReplaySubject<T>
@JvmStatic
fun <T> replaySubject(cacheSize: Int): ReplaySubject<T>

Returns an observable subject that emits values to any subscribers at the time of the emission.

stateSubject
Link copied to clipboard
@JvmStatic
fun <T> stateSubject(initialValue: T): StateSubject<T>

Returns an observable subject that emits values to any subscribers at the time of the emission.

Generated by Dokka
(c) Tealium 2026