Small BehaviorSubject fixes;

This commit is contained in:
bjorn 2015-11-12 19:27:43 -08:00
parent 007d9bce3d
commit ed9b5268e2
3 changed files with 23 additions and 23 deletions

View File

@ -908,13 +908,13 @@ Creates a new BehaviorSubject.
#### `:subscribe(onNext, onError, onCompleted)`
Creates a new Observer and attaches it to the Subject. Immediately broadcasts the most recent value to the Observer.
Creates a new Observer and attaches it to the BehaviorSubject. Immediately broadcasts the most recent value to the Observer.
| Name | Type | Default | Description |
|------|------|---------|-------------|
| `onNext` | function | | Called when the Subject produces a value. |
| `onError` | function | | Called when the Subject terminates due to an error. |
| `onCompleted` | function | | Called when the Subject completes normally. |
| `onNext` | function | | Called when the BehaviorSubject produces a value. |
| `onError` | function | | Called when the BehaviorSubject terminates due to an error. |
| `onCompleted` | function | | Called when the BehaviorSubject completes normally. |
---
@ -930,7 +930,7 @@ Pushes zero or more values to the BehaviorSubject. They will be broadcasted to a
#### `:getValue()`
Returns the last value emitted by the Subject, or the initial value passed to the constructor if nothing has been emitted yet.
Returns the last value emitted by the BehaviorSubject, or the initial value passed to the constructor if nothing has been emitted yet.
# ReplaySubject

18
rx.lua
View File

@ -1897,7 +1897,7 @@ BehaviorSubject.__tostring = util.constant('BehaviorSubject')
--- Creates a new BehaviorSubject.
-- @arg {*...} value - The initial values.
-- @returns {Subject}
-- @returns {BehaviorSubject}
function BehaviorSubject.create(...)
local self = {
observers = {},
@ -1911,11 +1911,11 @@ function BehaviorSubject.create(...)
return setmetatable(self, BehaviorSubject)
end
--- Creates a new Observer and attaches it to the Subject. Immediately broadcasts the most recent
-- value to the Observer.
-- @arg {function} onNext - Called when the Subject produces a value.
-- @arg {function} onError - Called when the Subject terminates due to an error.
-- @arg {function} onCompleted - Called when the Subject completes normally.
--- Creates a new Observer and attaches it to the BehaviorSubject. Immediately broadcasts the most
-- recent value to the Observer.
-- @arg {function} onNext - Called when the BehaviorSubject produces a value.
-- @arg {function} onError - Called when the BehaviorSubject terminates due to an error.
-- @arg {function} onCompleted - Called when the BehaviorSubject completes normally.
function BehaviorSubject:subscribe(onNext, onError, onCompleted)
local observer
@ -1928,7 +1928,7 @@ function BehaviorSubject:subscribe(onNext, onError, onCompleted)
local subscription = Subject.subscribe(self, observer)
if self.value then
observer:onNext(unpack(self.value))
observer:onNext(util.unpack(self.value))
end
return subscription
@ -1941,8 +1941,8 @@ function BehaviorSubject:onNext(...)
return Subject.onNext(self, ...)
end
--- Returns the last value emitted by the Subject, or the initial value passed to the constructor
-- if nothing has been emitted yet.
--- Returns the last value emitted by the BehaviorSubject, or the initial value passed to the
-- constructor if nothing has been emitted yet.
-- @returns {*...}
function BehaviorSubject:getValue()
if self.value ~= nil then

View File

@ -11,7 +11,7 @@ BehaviorSubject.__tostring = util.constant('BehaviorSubject')
--- Creates a new BehaviorSubject.
-- @arg {*...} value - The initial values.
-- @returns {Subject}
-- @returns {BehaviorSubject}
function BehaviorSubject.create(...)
local self = {
observers = {},
@ -25,11 +25,11 @@ function BehaviorSubject.create(...)
return setmetatable(self, BehaviorSubject)
end
--- Creates a new Observer and attaches it to the Subject. Immediately broadcasts the most recent
-- value to the Observer.
-- @arg {function} onNext - Called when the Subject produces a value.
-- @arg {function} onError - Called when the Subject terminates due to an error.
-- @arg {function} onCompleted - Called when the Subject completes normally.
--- Creates a new Observer and attaches it to the BehaviorSubject. Immediately broadcasts the most
-- recent value to the Observer.
-- @arg {function} onNext - Called when the BehaviorSubject produces a value.
-- @arg {function} onError - Called when the BehaviorSubject terminates due to an error.
-- @arg {function} onCompleted - Called when the BehaviorSubject completes normally.
function BehaviorSubject:subscribe(onNext, onError, onCompleted)
local observer
@ -42,7 +42,7 @@ function BehaviorSubject:subscribe(onNext, onError, onCompleted)
local subscription = Subject.subscribe(self, observer)
if self.value then
observer:onNext(unpack(self.value))
observer:onNext(util.unpack(self.value))
end
return subscription
@ -55,8 +55,8 @@ function BehaviorSubject:onNext(...)
return Subject.onNext(self, ...)
end
--- Returns the last value emitted by the Subject, or the initial value passed to the constructor
-- if nothing has been emitted yet.
--- Returns the last value emitted by the BehaviorSubject, or the initial value passed to the
-- constructor if nothing has been emitted yet.
-- @returns {*...}
function BehaviorSubject:getValue()
if self.value ~= nil then