Skip to content

Commit ed9b526

Browse files
committed
Small BehaviorSubject fixes;
1 parent 007d9bc commit ed9b526

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

doc/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -908,13 +908,13 @@ Creates a new BehaviorSubject.
908908

909909
#### `:subscribe(onNext, onError, onCompleted)`
910910

911-
Creates a new Observer and attaches it to the Subject. Immediately broadcasts the most recent value to the Observer.
911+
Creates a new Observer and attaches it to the BehaviorSubject. Immediately broadcasts the most recent value to the Observer.
912912

913913
| Name | Type | Default | Description |
914914
|------|------|---------|-------------|
915-
| `onNext` | function | | Called when the Subject produces a value. |
916-
| `onError` | function | | Called when the Subject terminates due to an error. |
917-
| `onCompleted` | function | | Called when the Subject completes normally. |
915+
| `onNext` | function | | Called when the BehaviorSubject produces a value. |
916+
| `onError` | function | | Called when the BehaviorSubject terminates due to an error. |
917+
| `onCompleted` | function | | Called when the BehaviorSubject completes normally. |
918918

919919
---
920920

@@ -930,7 +930,7 @@ Pushes zero or more values to the BehaviorSubject. They will be broadcasted to a
930930

931931
#### `:getValue()`
932932

933-
Returns the last value emitted by the Subject, or the initial value passed to the constructor if nothing has been emitted yet.
933+
Returns the last value emitted by the BehaviorSubject, or the initial value passed to the constructor if nothing has been emitted yet.
934934

935935
# ReplaySubject
936936

rx.lua

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1897,7 +1897,7 @@ BehaviorSubject.__tostring = util.constant('BehaviorSubject')
18971897

18981898
--- Creates a new BehaviorSubject.
18991899
-- @arg {*...} value - The initial values.
1900-
-- @returns {Subject}
1900+
-- @returns {BehaviorSubject}
19011901
function BehaviorSubject.create(...)
19021902
local self = {
19031903
observers = {},
@@ -1911,11 +1911,11 @@ function BehaviorSubject.create(...)
19111911
return setmetatable(self, BehaviorSubject)
19121912
end
19131913

1914-
--- Creates a new Observer and attaches it to the Subject. Immediately broadcasts the most recent
1915-
-- value to the Observer.
1916-
-- @arg {function} onNext - Called when the Subject produces a value.
1917-
-- @arg {function} onError - Called when the Subject terminates due to an error.
1918-
-- @arg {function} onCompleted - Called when the Subject completes normally.
1914+
--- Creates a new Observer and attaches it to the BehaviorSubject. Immediately broadcasts the most
1915+
-- recent value to the Observer.
1916+
-- @arg {function} onNext - Called when the BehaviorSubject produces a value.
1917+
-- @arg {function} onError - Called when the BehaviorSubject terminates due to an error.
1918+
-- @arg {function} onCompleted - Called when the BehaviorSubject completes normally.
19191919
function BehaviorSubject:subscribe(onNext, onError, onCompleted)
19201920
local observer
19211921

@@ -1928,7 +1928,7 @@ function BehaviorSubject:subscribe(onNext, onError, onCompleted)
19281928
local subscription = Subject.subscribe(self, observer)
19291929

19301930
if self.value then
1931-
observer:onNext(unpack(self.value))
1931+
observer:onNext(util.unpack(self.value))
19321932
end
19331933

19341934
return subscription
@@ -1941,8 +1941,8 @@ function BehaviorSubject:onNext(...)
19411941
return Subject.onNext(self, ...)
19421942
end
19431943

1944-
--- Returns the last value emitted by the Subject, or the initial value passed to the constructor
1945-
-- if nothing has been emitted yet.
1944+
--- Returns the last value emitted by the BehaviorSubject, or the initial value passed to the
1945+
-- constructor if nothing has been emitted yet.
19461946
-- @returns {*...}
19471947
function BehaviorSubject:getValue()
19481948
if self.value ~= nil then

src/subjects/behaviorsubject.lua

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ BehaviorSubject.__tostring = util.constant('BehaviorSubject')
1111

1212
--- Creates a new BehaviorSubject.
1313
-- @arg {*...} value - The initial values.
14-
-- @returns {Subject}
14+
-- @returns {BehaviorSubject}
1515
function BehaviorSubject.create(...)
1616
local self = {
1717
observers = {},
@@ -25,11 +25,11 @@ function BehaviorSubject.create(...)
2525
return setmetatable(self, BehaviorSubject)
2626
end
2727

28-
--- Creates a new Observer and attaches it to the Subject. Immediately broadcasts the most recent
29-
-- value to the Observer.
30-
-- @arg {function} onNext - Called when the Subject produces a value.
31-
-- @arg {function} onError - Called when the Subject terminates due to an error.
32-
-- @arg {function} onCompleted - Called when the Subject completes normally.
28+
--- Creates a new Observer and attaches it to the BehaviorSubject. Immediately broadcasts the most
29+
-- recent value to the Observer.
30+
-- @arg {function} onNext - Called when the BehaviorSubject produces a value.
31+
-- @arg {function} onError - Called when the BehaviorSubject terminates due to an error.
32+
-- @arg {function} onCompleted - Called when the BehaviorSubject completes normally.
3333
function BehaviorSubject:subscribe(onNext, onError, onCompleted)
3434
local observer
3535

@@ -42,7 +42,7 @@ function BehaviorSubject:subscribe(onNext, onError, onCompleted)
4242
local subscription = Subject.subscribe(self, observer)
4343

4444
if self.value then
45-
observer:onNext(unpack(self.value))
45+
observer:onNext(util.unpack(self.value))
4646
end
4747

4848
return subscription
@@ -55,8 +55,8 @@ function BehaviorSubject:onNext(...)
5555
return Subject.onNext(self, ...)
5656
end
5757

58-
--- Returns the last value emitted by the Subject, or the initial value passed to the constructor
59-
-- if nothing has been emitted yet.
58+
--- Returns the last value emitted by the BehaviorSubject, or the initial value passed to the
59+
-- constructor if nothing has been emitted yet.
6060
-- @returns {*...}
6161
function BehaviorSubject:getValue()
6262
if self.value ~= nil then

0 commit comments

Comments
 (0)