Links

AsyncSubject

AsyncSubjects are subjects that produce either no values or a single value. If multiple values are produced via onNext, only the last one is used. If onError is called, then no value is produced and onError is called on any subscribed Observers. If an Observer subscribes and the AsyncSubject has already terminated, the Observer will immediately receive the value or the error.

API Overview

  • Constructors - API calls which return an object, typically one that offers API methods
  • create
  • Methods - API calls which can only be made on an object returned by a constructor
  • onError
  • onNext
  • subscribe

API Documentation

Constructors

create

Signature
cp.rx.AsyncSubject.create() -> cp.rx.AsyncSubject
Type
Constructor
Description
Creates a new AsyncSubject.
Returns
  • The new AsyncSubject.

Methods

Signature
cp.rx.AsyncSubject:onCompleted() -> nil
Type
Method
Description
Signal to all Observers that the AsyncSubject will not produce any more values.

onError

Signature
cp.rx.AsyncSubject:onError(message) -> nil
Type
Method
Description
Signal to all Observers that an error has occurred.
Parameters
  • message - A string describing what went wrong.

onNext

Signature
cp.rx.AsyncSubject:onNext(...) -> nil
Type
Method
Description
Pushes zero or more values to the AsyncSubject.
Parameters
  • ... - The values to send.

subscribe

Signature
cp.rx.AsyncSubject:subscribe(onNext, onError, onCompleted) -> cp.rx.Reference
Type
Method
Description
Creates a new Observer and attaches it to the AsyncSubject.
Parameters
  • onNext
Returns