Internationalisation
Bundled Plugins API
BehaviorSubject
A Subject that tracks its current value. Provides an accessor to retrieve the most recent pushed value, and all subscribers immediately receive the latest value.

API Overview

API Documentation

Methods

create

Signature
cp.rx.BehaviorSubject.create(...) -> cp.rx.BehaviorSubject
Type
Method
Description
Creates a new BehaviorSubject.
Parameters
  • ... - The initial values.
Returns
  • The new BehaviorSubject.

getValue

Signature
cp.rx.BehaviorSubject:getValue() -> anything
Type
Method
Description
Returns the last value emitted by the BehaviorSubject, or the initial value passed to the
Returns
  • The last value.

onNext

Signature
cp.rx.BehaviorSubject:onNext(...) -> nil
Type
Method
Description
Pushes zero or more values to the BehaviorSubject. They will be broadcasted to all Observers.
Parameters
  • ... - The values to send.

subscribe

| Signature | cp.rx.BehaviorSubject:subscribe(observer | onNext, onError, onCompleted) -> cp.rx.Reference | | -----------------------------------------------------|---------------------------------------------------------------------------------------------------------| | Type | Method | | Description | Creates a new Observer and attaches it to the BehaviorSubject. Immediately broadcasts the most | | Parameters |
  • observer | onNext - The Observer subscribing, or the function called when the BehaviorSubject produces a value.
  • onError - A function called when the BehaviorSubject terminates due to an error.
  • onCompleted - A function called when the BehaviorSubject completes normally.
| | Returns |
|
Last modified 1mo ago
Export as PDF
Copy link