Skip to content

Commit

Permalink
Small BehaviorSubject fixes;
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornbytes committed Nov 13, 2015
1 parent 007d9bc commit ed9b526
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
10 changes: 5 additions & 5 deletions doc/README.md
Expand Up @@ -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. |

---

Expand All @@ -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

Expand Down
18 changes: 9 additions & 9 deletions rx.lua
Expand Up @@ -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 = {},
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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
Expand Down
18 changes: 9 additions & 9 deletions src/subjects/behaviorsubject.lua
Expand Up @@ -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 = {},
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit ed9b526

Please sign in to comment.