# cp.rx.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

  • onCompleted
  • onError
  • onNext
  • subscribe

# API Documentation

# Constructors

# create

Signature cp.rx.AsyncSubject.create() -> cp.rx.AsyncSubject
Type Constructor
Description Creates a new AsyncSubject.
Parameters
  • None
Returns
  • The new AsyncSubject.
Notes None
Examples None
Source src/extensions/cp/rx/AsyncSubject.lua line 23

# Methods

# onCompleted

Signature cp.rx.AsyncSubject:onCompleted() -> nil
Type Method
Description Signal to all Observers that the AsyncSubject will not produce any more values.
Parameters
  • None
Returns
  • None
Notes None
Examples None
Source src/extensions/cp/rx/AsyncSubject.lua line 121

# 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.
Returns
  • None
Notes None
Examples None
Source src/extensions/cp/rx/AsyncSubject.lua line 99

# onNext

Signature cp.rx.AsyncSubject:onNext(...) -> nil
Type Method
Description Pushes zero or more values to the AsyncSubject.
Parameters
  • ... - The values to send.
Returns
  • None
Notes None
Examples None
Source src/extensions/cp/rx/AsyncSubject.lua line 84

# 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
observer - A function called when the AsyncSubject produces a value or an existing Observer to attach to the AsyncSubject.
  • onError - A function called when the AsyncSubject terminates due to an error.
  • onCompleted - A funtion called when the AsyncSubject completes normally.
  • Returns
    Notes None
    Examples None
    Source src/extensions/cp/rx/AsyncSubject.lua line 43