diff --git a/doc/README.md b/doc/README.md index e07b472..3d295b2 100644 --- a/doc/README.md +++ b/doc/README.md @@ -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 diff --git a/rx.lua b/rx.lua index 7caa39f..2d47319 100644 --- a/rx.lua +++ b/rx.lua @@ -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 diff --git a/src/subjects/behaviorsubject.lua b/src/subjects/behaviorsubject.lua index 72365e1..b12ade2 100644 --- a/src/subjects/behaviorsubject.lua +++ b/src/subjects/behaviorsubject.lua @@ -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