Skip to main content

Rx

Observable rx library for Roblox by Quenty. This provides a variety of composition classes to be used, and is the primary entry point for an observable.

Most of these functions return either a function that takes in an observable (curried for piping) or an Observable directly.

Properties

EMPTY

This item is read only and cannot be modified. Read Only
Rx.EMPTY: Observable<()>

An empty observable that completes immediately

NEVER

This item is read only and cannot be modified. Read Only
Rx.NEVER: Observable<()>

An observable that never completes.

Functions

pipe

Rx.pipe(transformers{Observable<any>}) → (sourceObservable<T>) → Observable<U>

Pipes the tranformers through each other https://rxjs-dev.firebaseapp.com/api/index/function/pipe

of

Rx.of(
...any--

Arguments to emit

) → Observable

http://reactivex.io/documentation/operators/just.html

Rx.of(1, 2, 3):Subscribe(print, function()
	print("Complete")
end)) --> 1, 2, 3, "Complete"

failed

Rx.failed(
...any--

Failure args

) → Observable

Returns a failed observable

from

Rx.from(itemPromise | table) → Observable

toPromise

Rx.toPromise(
observableObservable<T>,
cancelTokenCancelToken?
) → Promise<T>

Converts a promise to an observable.

merge

Rx.merge(observables{Observable}) → Observable

fromSignal

Rx.fromSignal(eventSignal<T>) → Observable<T>

fromPromise

Rx.fromPromise(promisePromise<T>) → Observable<T>

Converts a Promise into an observable. https://rxjs-dev.firebaseapp.com/api/index/function/from

tap

Rx.tap(
onFirefunction?,
onErrorfunction?,
onCompletefunction?
) → (sourceObservable<T>) → Observable<T>

Taps into the observable and executes the onFire/onError/onComplete commands.

https://rxjs-dev.firebaseapp.com/api/operators/tap

start

Rx.start(callbackfunction) → (sourceObservable) → Observable

Starts the observable with the given value from the callback

http://reactivex.io/documentation/operators/start.html

share

Rx.share() → (sourceObservable) → Observable

Returns a new Observable that multicasts (shares) the original Observable. As long as there is at least one Subscriber this Observable will be subscribed and emitting data. When all subscribers have unsubscribed it will unsubscribe from the source Observable.

https://rxjs.dev/api/operators/share

shareReplay

Rx.shareReplay(
bufferSizenumber,--

Number of entries to cache

windowTimeSecondsnumber--

Time

) → (sourceObservable) → Observable

Same as Rx.share except it also replays the value

cache

Rx.cache() → (sourceObservable) → Observable

Caches the current value

startFrom

Rx.startFrom(callback() → {T}) → (sourceObservable) → Observable

Like start, but also from (list!)

startWith

Rx.startWith(values{T}) → (sourceObservable) → Observable

scan

Rx.scan(
accumulatorfunction,
seedany | nil
) → (sourceObservable) → Observable

The Scan operator applies a function to the first item emitted by the source Observable and then emits the result of that function as its own first emission. It also feeds the result of the function back into the function along with the second item emitted by the source Observable in order to generate its second emission. It continues to feed back its own subsequent emissions along with the subsequent emissions from the source Observable in order to create the rest of its sequence.

https://reactivex.io/documentation/operators/scan.html

reduce

Rx.reduce(
reducerfunction,
seedany | nil
) → (sourceObservable) → Observable

The Reduce operator applies a function to the first item emitted by the source Observable and then feeds the result of the function back into the function along with the second item emitted by the source Observable, continuing this process until the source Observable emits its final item and completes, whereupon the Observable returned from Reduce emits the final value returned from the function.

https://reactivex.io/documentation/operators/reduce.html

defaultsTo

Rx.defaultsTo(valueany) → (sourceObservable) → Observable

Defaults the observable to a value if it isn't fired immediately

Rx.NEVER:Pipe({
	Rx.defaultsTo("Hello")
}):Subscribe(print) --> Hello

defaultsToNil

Rx.defaultsToNil(sourceObservable) → Observable

Defaults the observable value to nil

Rx.NEVER:Pipe({
	Rx.defaultsToNil
}):Subscribe(print) --> nil

Great for defaulting Roblox attributes and objects

endWith

Rx.endWith(values{T}) → (sourceObservable) → Observable

Ends the observable with these values before cancellation https://www.learnrxjs.io/learn-rxjs/operators/combination/endwith

where

Rx.where(predicate(valueT) → boolean) → (sourceObservable<T>) → Observable<T>

http://reactivex.io/documentation/operators/filter.html

Filters out values

Rx.of(1, 2, 3, 4, 5):Pipe({
	Rx.where(function(value)
		return value % 2 == 0;
	end)
}):Subscribe(print) --> 2, 4

distinct

Rx.distinct() → (sourceObservable<T>) → Observable<T>

Only takes distinct values from the observable stream.

http://reactivex.io/documentation/operators/distinct.html

Rx.of(1, 1, 2, 3, 3, 1):Pipe({
	Rx.distinct();
}):Subscribe(print) --> 1, 2, 3, 1

mapTo

Rx.mapTo(
...any--

The value to map each source value to.

) → (sourceObservable<T>) → Observable<T>

map

Rx.map(project(T) → U) → (sourceObservable<T>) → Observable<U>

http://reactivex.io/documentation/operators/map.html

Maps one value to another

Rx.of(1, 2, 3, 4, 5):Pipe({
	Rx.map(function(x)
		return x + 1
	end)
}):Subscribe(print) -> 2, 3, 4, 5, 6

mergeAll

Rx.mergeAll() → (sourceObservable<Observable<T>>) → Observable<T>

Merges higher order observables together.

Basically, if you have an observable that is emitting an observable, this subscribes to each emitted observable and combines them into a single observable.

Rx.of(Rx.of(1, 2, 3), Rx.of(4))
	:Pipe({
		Rx.mergeAll();
	})
	:Subscribe(print) -> 1, 2, 3, 4

switchAll

Rx.switchAll() → (sourceObservable<Observable<T>>) → Observable<T>

Merges higher order observables together

https://rxjs.dev/api/operators/switchAll

Works like mergeAll, where you subscribe to an observable which is emitting observables. However, when another observable is emitted it disconnects from the other observable and subscribes to that one.

flatMap

Rx.flatMap(
project(valueT) → Observable<U>,
resultSelector((
initialValueT,
outputValueU
) → U)?
) → (sourceObservable<T>) → Observable<U>

Sort of equivalent of promise.then()

This takes a stream of observables

switchMap

Rx.switchMap(projectfunction) → Observable

Switches to a new observable from the current observable

https://rxjs.dev/api/operators/switchMap

As each observable shows up, a new observable is mapped from that observable.

The old observable is disconnected.

Use Rx.switchMap to switch to a new RunService event

Rx.of(1, 2, 3):Pipe({
	Rx.switchMap(function(value)
		local startTime = os.clock()

		-- Only the last observable returned will continue to emit,
		-- others are disconnected.
		return Rx.of(RunService.RenderStepped):Pipe({
			Rx.map(function()
				return os.clock() - startTime, value
			end);
		});
	end);
}):Subscribe(print) --> 0.002352342, 3

Use Rx.switchMap() as a simple map...

Rx.of(1, 2, 3):Pipe({
	Rx.switchMap(function(value)
		print(value) --> 1 (and then 2, and then 3)

		return Rx.of(value*2)
	end);
}):Subscribe(print) --> 2, 4, 6

Use Rx.switchMap() with delayed input (to swap to a new one)

Rx.of(1, 2, 3):Pipe({
	Rx.switchMap(function(value)
		-- Emit 1 second later
		return Rx.of(value*2):Pipe({
			Rx.delay(1); -- These will each get cancelled
		})
	end);
}):Subscribe(print) --> 6 (other results were cancelled)

packed

Rx.packed(...any) → Observable

Returns an observable that takes in a tuple, and emits that tuple, then completes.

Rx.packed("a", "b")
	:Subscribe(function(first, second)
		print(first, second) --> a, b
	end)

unpacked

Rx.unpacked(observableObservable<{T}>) → Observable<T>

Unpacks the observables value if a table is received

finalize

Rx.finalize(finalizerCallback() → ()) → (sourceObservable<T>) → Observable<T>

Acts as a finalizer callback once the subscription is unsubscribed.

	Rx.of("a", "b"):Pipe({
		Rx.finalize(function()
			print("Subscription done!")
		end);
	})

http://reactivex.io/documentation/operators/do.html https://rxjs-dev.firebaseapp.com/api/operators/finalize https://github.com/ReactiveX/rxjs/blob/master/src/internal/operators/finalize.ts

combineLatestAll

Rx.combineLatestAll() → (sourceObservable<Observable<T>>) → Observable<{T}>

Given an observable that emits observables, emit an observable that once the initial observable completes, the latest values of each emitted observable will be combined into an array that will be emitted.

https://rxjs.dev/api/operators/combineLatestAll

catchError

Rx.catchError(callback(errorTError) → Observable<TErrorResult>) → (sourceObservable<T>) → Observable<T | TErrorResult>

Catches an error, and allows another observable to be subscribed in terms of handling the error.

warning

This method is not yet tested

combineLatest

Rx.combineLatest(observables{[TKey]Observable<TEmitted> | TEmitted}) → Observable<{[TKey]TEmitted}>

One of the most useful functions this combines the latest values of observables at each chance!

Rx.combineLatest({
	child = Rx.fromSignal(Workspace.ChildAdded);
	lastChildRemoved = Rx.fromSignal(Workspace.ChildRemoved);
	value = 5;

}):Subscribe(function(data)
	print(data.child) --> last child
	print(data.lastChildRemoved) --> other value
	print(data.value) --> 5
end)

tip

Note that the resulting observable will not emit until all input observables are emitted.

using

Rx.using(
resourceFactory() → MaidTask,
observableFactory(MaidTask) → Observable<T>
) → Observable<T>

http://reactivex.io/documentation/operators/using.html

Each time a subscription occurs, the resource is constructed and exists for the lifetime of the observation. The observableFactory uses the resource for subscription.

note

Note from Quenty: I haven't found this that useful.

first

Rx.first() → (sourceObservable<T>) → Observable<T>

Takes the first entry and terminates the observable. Equivalent to the following:

Rx.take(1)

https://reactivex.io/documentation/operators/first.html

take

Rx.take(numbernumber) → (sourceObservable<T>) → Observable<T>

Takes n entries and then completes the observation.

https://rxjs.dev/api/operators/take

skip

Rx.skip(toSkipnumber) → (sourceObservable<T>) → Observable<T>

Takes n entries and then completes the observation.

https://rxjs.dev/api/operators/take

defer

Rx.defer(observableFactory() → Observable<T>) → Observable<T>

Defers the subscription and creation of the observable until the actual subscription of the observable.

https://rxjs-dev.firebaseapp.com/api/index/function/defer https://netbasal.com/getting-to-know-the-defer-observable-in-rxjs-a16f092d8c09

delay

Rx.delay(secondsnumber) → (sourceObservable<T>) → Observable<T>

Shift the emissions from an Observable forward in time by a particular amount.

delayed

Rx.delayed(secondsnumber) → Observable<()>

Creates an observable that will emit N seconds later.

timer

Rx.timer(
initialDelaySecondsnumber,
secondsnumber
) → (sourceObservable<number>) → Observable<number>

Emits output every n seconds

interval

Rx.interval(secondsnumber) → (sourceObservable<number>) → Observable<number>

withLatestFrom

Rx.withLatestFrom(inputObservables{Observable<TInput>}) → (sourceObservable<T>) → Observable<{
T,
...TInput
}>

throttleTime

Rx.throttleTime(
durationnumber,
throttleConfig{leading=true;trailing=true;}
) → (sourceObservable) → Observable

Throttles emission of observables.

https://rxjs-dev.firebaseapp.com/api/operators/throttleTime

note

Note that on complete, the last item is not included, for now, unlike the existing version in rxjs.

onlyAfterDefer

Rx.onlyAfterDefer() → (sourceObservable) → Observable

Only emits events after the deferred first signal.

throttleDefer

Rx.throttleDefer() → (sourceObservable) → Observable

Throttles emission of observables on the defer stack to the last emission.

tip

There's a limited re-entrance amount for this. However, this can prevent computation being done repeatedly if stuff is being added all at once. Use with care.

throttle

Rx.throttle(durationSelector(Tvalue) → Observable) → (sourceObservable<T>) → Observable<T>

Throttles emission of observables on the defer stack to the last emission.

https://rxjs.dev/api/operators/throttle

combineAll

deprecated in 1.0.0
</>
This was deprecated in 1.0.0

Use Rx.combineLatestAll

Rx.combineAll() → (sourceObservable<Observable<T>>) → Observable<{T}>

The same as combineLatestAll.

This is for backwards compatability, and is deprecated.

Show raw api
{
    "functions": [
        {
            "name": "pipe",
            "desc": "Pipes the tranformers through each other\nhttps://rxjs-dev.firebaseapp.com/api/index/function/pipe",
            "params": [
                {
                    "name": "transformers",
                    "desc": "",
                    "lua_type": "{ Observable<any> }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable<T>) -> Observable<U>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 54,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "of",
            "desc": "http://reactivex.io/documentation/operators/just.html\n\n```lua\nRx.of(1, 2, 3):Subscribe(print, function()\n\tprint(\"Complete\")\nend)) --> 1, 2, 3, \"Complete\"\n```",
            "params": [
                {
                    "name": "...",
                    "desc": "Arguments to emit",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 92,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "failed",
            "desc": "Returns a failed observable",
            "params": [
                {
                    "name": "...",
                    "desc": "Failure args",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 110,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "from",
            "desc": "Converts an item\nhttp://reactivex.io/documentation/operators/from.html",
            "params": [
                {
                    "name": "item",
                    "desc": "",
                    "lua_type": "Promise | table"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 125,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "toPromise",
            "desc": "Converts a promise to an observable.",
            "params": [
                {
                    "name": "observable",
                    "desc": "",
                    "lua_type": "Observable<T>"
                },
                {
                    "name": "cancelToken",
                    "desc": "",
                    "lua_type": "CancelToken?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<T>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 142,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "merge",
            "desc": "https://rxjs-dev.firebaseapp.com/api/operators/merge",
            "params": [
                {
                    "name": "observables",
                    "desc": "",
                    "lua_type": "{ Observable }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 182,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "fromSignal",
            "desc": "Converts a Signal into an observable.\nhttps://rxjs-dev.firebaseapp.com/api/index/function/fromEvent",
            "params": [
                {
                    "name": "event",
                    "desc": "",
                    "lua_type": "Signal<T>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<T>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 221,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "fromPromise",
            "desc": "Converts a Promise into an observable.\nhttps://rxjs-dev.firebaseapp.com/api/index/function/from",
            "params": [
                {
                    "name": "promise",
                    "desc": "",
                    "lua_type": "Promise<T>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<T>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 237,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "tap",
            "desc": "Taps into the observable and executes the onFire/onError/onComplete\ncommands.\n\nhttps://rxjs-dev.firebaseapp.com/api/operators/tap",
            "params": [
                {
                    "name": "onFire",
                    "desc": "",
                    "lua_type": "function?"
                },
                {
                    "name": "onError",
                    "desc": "",
                    "lua_type": "function?"
                },
                {
                    "name": "onComplete",
                    "desc": "",
                    "lua_type": "function?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable<T>) -> Observable<T>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 283,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "start",
            "desc": "Starts the observable with the given value from the callback\n\nhttp://reactivex.io/documentation/operators/start.html",
            "params": [
                {
                    "name": "callback",
                    "desc": "",
                    "lua_type": "function"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable) -> Observable"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 325,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "share",
            "desc": "Returns a new Observable that multicasts (shares) the original Observable. As long as there is at least one Subscriber this Observable will be subscribed and emitting data.\nWhen all subscribers have unsubscribed it will unsubscribe from the source Observable.\n\nhttps://rxjs.dev/api/operators/share",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable) -> Observable"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 345,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "shareReplay",
            "desc": "Same as [Rx.share] except it also replays the value",
            "params": [
                {
                    "name": "bufferSize",
                    "desc": "Number of entries to cache",
                    "lua_type": "number"
                },
                {
                    "name": "windowTimeSeconds",
                    "desc": "Time",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable) -> Observable"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 420,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "cache",
            "desc": "Caches the current value",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable) -> Observable"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 543,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "startFrom",
            "desc": "Like start, but also from (list!)",
            "params": [
                {
                    "name": "callback",
                    "desc": "",
                    "lua_type": "() -> { T }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable) -> Observable"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 553,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "startWith",
            "desc": "Starts with the given values\nhttps://rxjs-dev.firebaseapp.com/api/operators/startWith",
            "params": [
                {
                    "name": "values",
                    "desc": "",
                    "lua_type": "{ T }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable) -> Observable"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 575,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "scan",
            "desc": "The Scan operator applies a function to the first item emitted by the source Observable and then\nemits the result of that function as its own first emission. It also feeds the result of the function\nback into the function along with the second item emitted by the source Observable in order to generate\nits second emission. It continues to feed back its own subsequent emissions along with the subsequent\nemissions from the source Observable in order to create the rest of its sequence.\n\nhttps://reactivex.io/documentation/operators/scan.html",
            "params": [
                {
                    "name": "accumulator",
                    "desc": "",
                    "lua_type": "function"
                },
                {
                    "name": "seed",
                    "desc": "",
                    "lua_type": "any | nil"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable) -> Observable"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 604,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "reduce",
            "desc": "The Reduce operator applies a function to the first item emitted by the source Observable and\nthen feeds the result of the function back into the function along with the second item emitted\nby the source Observable, continuing this process until the source Observable emits its final\nitem and completes, whereupon the Observable returned from Reduce emits the final value returned\nfrom the function.\n\nhttps://reactivex.io/documentation/operators/reduce.html",
            "params": [
                {
                    "name": "reducer",
                    "desc": "",
                    "lua_type": "function"
                },
                {
                    "name": "seed",
                    "desc": "",
                    "lua_type": "any | nil"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable) -> Observable"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 634,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "defaultsTo",
            "desc": "Defaults the observable to a value if it isn't fired immediately\n\n```lua\nRx.NEVER:Pipe({\n\tRx.defaultsTo(\"Hello\")\n}):Subscribe(print) --> Hello\n```",
            "params": [
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable) -> Observable"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 673,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "defaultsToNil",
            "desc": "Defaults the observable value to nil\n\n```lua\nRx.NEVER:Pipe({\n\tRx.defaultsToNil\n}):Subscribe(print) --> nil\n```\n\nGreat for defaulting Roblox attributes and objects",
            "params": [
                {
                    "name": "source",
                    "desc": "",
                    "lua_type": "Observable"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 714,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "endWith",
            "desc": "Ends the observable with these values before cancellation\nhttps://www.learnrxjs.io/learn-rxjs/operators/combination/endwith",
            "params": [
                {
                    "name": "values",
                    "desc": "",
                    "lua_type": "{ T }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable) -> Observable"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 723,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "where",
            "desc": "http://reactivex.io/documentation/operators/filter.html\n\nFilters out values\n\n```lua\nRx.of(1, 2, 3, 4, 5):Pipe({\n\tRx.where(function(value)\n\t\treturn value % 2 == 0;\n\tend)\n}):Subscribe(print) --> 2, 4\n```",
            "params": [
                {
                    "name": "predicate",
                    "desc": "",
                    "lua_type": "(value: T) -> boolean"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable<T>) -> Observable<T>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 767,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "distinct",
            "desc": "Only takes distinct values from the observable stream.\n\nhttp://reactivex.io/documentation/operators/distinct.html\n\n```lua\nRx.of(1, 1, 2, 3, 3, 1):Pipe({\n\tRx.distinct();\n}):Subscribe(print) --> 1, 2, 3, 1\n```",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable<T>) -> Observable<T>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 798,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "mapTo",
            "desc": "https://rxjs.dev/api/operators/mapTo",
            "params": [
                {
                    "name": "...",
                    "desc": "The value to map each source value to.",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable<T>) -> Observable<T>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 826,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "map",
            "desc": "http://reactivex.io/documentation/operators/map.html\n\nMaps one value to another\n\n```lua\nRx.of(1, 2, 3, 4, 5):Pipe({\n\tRx.map(function(x)\n\t\treturn x + 1\n\tend)\n}):Subscribe(print) -> 2, 3, 4, 5, 6\n```",
            "params": [
                {
                    "name": "project",
                    "desc": "",
                    "lua_type": "(T) -> U"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable<T>) -> Observable<U>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 855,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "mergeAll",
            "desc": "Merges higher order observables together.\n\nBasically, if you have an observable that is emitting an observable,\nthis subscribes to each emitted observable and combines them into a\nsingle observable.\n\n```lua\nRx.of(Rx.of(1, 2, 3), Rx.of(4))\n\t:Pipe({\n\t\tRx.mergeAll();\n\t})\n\t:Subscribe(print) -> 1, 2, 3, 4\n```",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable<Observable<T>>) -> Observable<T>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 886,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "switchAll",
            "desc": "Merges higher order observables together\n\nhttps://rxjs.dev/api/operators/switchAll\n\nWorks like mergeAll, where you subscribe to an observable which is\nemitting observables. However, when another observable is emitted it\ndisconnects from the other observable and subscribes to that one.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable<Observable<T>>) -> Observable<T>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 957,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "flatMap",
            "desc": "Sort of equivalent of promise.then()\n\nThis takes a stream of observables",
            "params": [
                {
                    "name": "project",
                    "desc": "",
                    "lua_type": "(value: T) -> Observable<U>"
                },
                {
                    "name": "resultSelector",
                    "desc": "",
                    "lua_type": "((initialValue: T, outputValue: U) -> U)?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable<T>) -> Observable<U>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1039,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "switchMap",
            "desc": "Switches to a new observable from the current observable\n\nhttps://rxjs.dev/api/operators/switchMap\n\nAs each observable shows up, a new observable is mapped from that observable.\n\nThe old observable is disconnected.\n\nUse Rx.switchMap to switch to a new RunService event\n\n```lua\nRx.of(1, 2, 3):Pipe({\n\tRx.switchMap(function(value)\n\t\tlocal startTime = os.clock()\n\n\t\t-- Only the last observable returned will continue to emit,\n\t\t-- others are disconnected.\n\t\treturn Rx.of(RunService.RenderStepped):Pipe({\n\t\t\tRx.map(function()\n\t\t\t\treturn os.clock() - startTime, value\n\t\t\tend);\n\t\t});\n\tend);\n}):Subscribe(print) --> 0.002352342, 3\n```\n\nUse Rx.switchMap() as a simple map...\n\n```lua\nRx.of(1, 2, 3):Pipe({\n\tRx.switchMap(function(value)\n\t\tprint(value) --> 1 (and then 2, and then 3)\n\n\t\treturn Rx.of(value*2)\n\tend);\n}):Subscribe(print) --> 2, 4, 6\n\n```\n\nUse Rx.switchMap() with delayed input (to swap to a new one)\n\n```lua\nRx.of(1, 2, 3):Pipe({\n\tRx.switchMap(function(value)\n\t\t-- Emit 1 second later\n\t\treturn Rx.of(value*2):Pipe({\n\t\t\tRx.delay(1); -- These will each get cancelled\n\t\t})\n\tend);\n}):Subscribe(print) --> 6 (other results were cancelled)\n```",
            "params": [
                {
                    "name": "project",
                    "desc": "",
                    "lua_type": "function"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1167,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "packed",
            "desc": "Returns an observable that takes in a tuple, and emits that tuple, then\ncompletes.\n\n```lua\nRx.packed(\"a\", \"b\")\n\t:Subscribe(function(first, second)\n\t\tprint(first, second) --> a, b\n\tend)\n```",
            "params": [
                {
                    "name": "...",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1220,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "unpacked",
            "desc": "Unpacks the observables value if a table is received",
            "params": [
                {
                    "name": "observable",
                    "desc": "",
                    "lua_type": "Observable<{T}>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<T>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1234,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "finalize",
            "desc": "Acts as a finalizer callback once the subscription is unsubscribed.\n\n```lua\n\tRx.of(\"a\", \"b\"):Pipe({\n\t\tRx.finalize(function()\n\t\t\tprint(\"Subscription done!\")\n\t\tend);\n\t})\n```\n\nhttp://reactivex.io/documentation/operators/do.html\nhttps://rxjs-dev.firebaseapp.com/api/operators/finalize\nhttps://github.com/ReactiveX/rxjs/blob/master/src/internal/operators/finalize.ts",
            "params": [
                {
                    "name": "finalizerCallback",
                    "desc": "",
                    "lua_type": "() -> ()"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable<T>) -> Observable<T>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1267,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "combineLatestAll",
            "desc": "Given an observable that emits observables, emit an\nobservable that once the initial observable completes,\nthe latest values of each emitted observable will be\ncombined into an array that will be emitted.\n\nhttps://rxjs.dev/api/operators/combineLatestAll",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable<Observable<T>>) -> Observable<{ T }>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1294,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "combineAll",
            "desc": "The same as combineLatestAll.\n\nThis is for backwards compatability, and is deprecated.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable<Observable<T>>) -> Observable<{ T }>"
                }
            ],
            "function_type": "static",
            "deprecated": {
                "version": "1.0.0",
                "desc": "Use Rx.combineLatestAll"
            },
            "source": {
                "line": 1340,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "catchError",
            "desc": "Catches an error, and allows another observable to be subscribed\nin terms of handling the error.\n\n:::warning\nThis method is not yet tested\n:::",
            "params": [
                {
                    "name": "callback",
                    "desc": "",
                    "lua_type": "(error: TError) -> Observable<TErrorResult>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable<T>) -> Observable<T | TErrorResult>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1353,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "combineLatest",
            "desc": "One of the most useful functions this combines the latest values of\nobservables at each chance!\n\n```lua\nRx.combineLatest({\n\tchild = Rx.fromSignal(Workspace.ChildAdded);\n\tlastChildRemoved = Rx.fromSignal(Workspace.ChildRemoved);\n\tvalue = 5;\n\n}):Subscribe(function(data)\n\tprint(data.child) --> last child\n\tprint(data.lastChildRemoved) --> other value\n\tprint(data.value) --> 5\nend)\n\n```\n\n:::tip\nNote that the resulting observable will not emit until all input\nobservables are emitted.\n:::",
            "params": [
                {
                    "name": "observables",
                    "desc": "",
                    "lua_type": "{ [TKey]: Observable<TEmitted> | TEmitted }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<{ [TKey]: TEmitted }>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1421,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "using",
            "desc": "http://reactivex.io/documentation/operators/using.html\n\nEach time a subscription occurs, the resource is constructed\nand exists for the lifetime of the observation. The observableFactory\nuses the resource for subscription.\n\n:::note\nNote from Quenty: I haven't found this that useful.\n:::",
            "params": [
                {
                    "name": "resourceFactory",
                    "desc": "",
                    "lua_type": "() -> MaidTask"
                },
                {
                    "name": "observableFactory",
                    "desc": "",
                    "lua_type": "(MaidTask) -> Observable<T>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<T>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1496,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "first",
            "desc": "Takes the first entry and terminates the observable. Equivalent to the following:\n\n```lua\nRx.take(1)\n```\n\nhttps://reactivex.io/documentation/operators/first.html",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable<T>) -> Observable<T>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1522,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "take",
            "desc": "Takes n entries and then completes the observation.\n\nhttps://rxjs.dev/api/operators/take",
            "params": [
                {
                    "name": "number",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable<T>) -> Observable<T>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1533,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "skip",
            "desc": "Takes n entries and then completes the observation.\n\nhttps://rxjs.dev/api/operators/take",
            "params": [
                {
                    "name": "toSkip",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable<T>) -> Observable<T>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1573,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "defer",
            "desc": "Defers the subscription and creation of the observable until the\nactual subscription of the observable.\n\nhttps://rxjs-dev.firebaseapp.com/api/index/function/defer\nhttps://netbasal.com/getting-to-know-the-defer-observable-in-rxjs-a16f092d8c09",
            "params": [
                {
                    "name": "observableFactory",
                    "desc": "",
                    "lua_type": "() -> Observable<T>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<T>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1608,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "delay",
            "desc": "Shift the emissions from an Observable forward in time by a particular amount.",
            "params": [
                {
                    "name": "seconds",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable<T>) -> Observable<T>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1635,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "delayed",
            "desc": "Creates an observable that will emit N seconds later.",
            "params": [
                {
                    "name": "seconds",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<()>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1664,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "timer",
            "desc": "Emits output every `n` seconds",
            "params": [
                {
                    "name": "initialDelaySeconds",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "seconds",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable<number>) -> Observable<number>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1681,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "interval",
            "desc": "https://www.learnrxjs.io/learn-rxjs/operators/creation/interval",
            "params": [
                {
                    "name": "seconds",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable<number>) -> Observable<number>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1712,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "withLatestFrom",
            "desc": "Honestly, I have not used this one much.\n\nhttps://rxjs-dev.firebaseapp.com/api/operators/withLatestFrom\nhttps://medium.com/js-in-action/rxjs-nosy-combinelatest-vs-selfish-withlatestfrom-a957e1af42bf",
            "params": [
                {
                    "name": "inputObservables",
                    "desc": "",
                    "lua_type": "{Observable<TInput>}"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable<T>) -> Observable<{T, ...TInput}>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1727,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "throttleTime",
            "desc": "Throttles emission of observables.\n\nhttps://rxjs-dev.firebaseapp.com/api/operators/throttleTime\n\n:::note\nNote that on complete, the last item is not included, for now, unlike the existing version in rxjs.\n:::",
            "params": [
                {
                    "name": "duration",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "throttleConfig",
                    "desc": "",
                    "lua_type": "{ leading = true; trailing = true; }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable) -> Observable"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1778,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "onlyAfterDefer",
            "desc": "Only emits events after the deferred first signal.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable) -> Observable"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1807,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "throttleDefer",
            "desc": "Throttles emission of observables on the defer stack to the last emission.\n\n:::tip\nThere's a limited re-entrance amount for this. However, this can prevent computation being done repeatedly if\nstuff is being added all at once. Use with care.\n:::",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable) -> Observable"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1834,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "throttle",
            "desc": "Throttles emission of observables on the defer stack to the last emission.\n\nhttps://rxjs.dev/api/operators/throttle",
            "params": [
                {
                    "name": "durationSelector",
                    "desc": "",
                    "lua_type": "(T: value) -> Observable"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(source: Observable<T>) -> Observable<T>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1875,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        }
    ],
    "properties": [
        {
            "name": "EMPTY",
            "desc": "An empty observable that completes immediately",
            "lua_type": "Observable<()>",
            "readonly": true,
            "source": {
                "line": 31,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        },
        {
            "name": "NEVER",
            "desc": "An observable that never completes.",
            "lua_type": "Observable<()>",
            "readonly": true,
            "source": {
                "line": 38,
                "path": "src/rx/src/Shared/Rx.lua"
            }
        }
    ],
    "types": [],
    "name": "Rx",
    "desc": "Observable rx library for Roblox by Quenty. This provides a variety of\ncomposition classes to be used, and is the primary entry point for an\nobservable.\n\nMost of these functions return either a function that takes in an\nobservable (curried for piping) or an [Observable](/api/Observable)\ndirectly.",
    "source": {
        "line": 12,
        "path": "src/rx/src/Shared/Rx.lua"
    }
}