#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

Methods - API calls which can only be made on an object returned by a constructor


#API Documentation

#Constructors

Signaturecp.rx.AsyncSubject.create() -> cp.rx.AsyncSubject
TypeConstructor
DescriptionCreates a new AsyncSubject.
Parameters
  • None
Returns
  • The new AsyncSubject.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/rx/AsyncSubject.lua line 23

#Methods

Signaturecp.rx.AsyncSubject:onCompleted() -> nil
TypeMethod
DescriptionSignal to all Observers that the AsyncSubject will not produce any more values.
Parameters
  • None
Returns
  • None
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/rx/AsyncSubject.lua line 121

Signaturecp.rx.AsyncSubject:onError(message) -> nil
TypeMethod
DescriptionSignal to all Observers that an error has occurred.
Parameters
  • message - A string describing what went wrong.
Returns
  • None
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/rx/AsyncSubject.lua line 99

Signaturecp.rx.AsyncSubject:onNext(...) -> nil
TypeMethod
DescriptionPushes zero or more values to the AsyncSubject.
Parameters
  • ... - The values to send.
Returns
  • None
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/rx/AsyncSubject.lua line 84

Signaturecp.rx.AsyncSubject:subscribe(onNext, onError, onCompleted) -> cp.rx.Reference
TypeMethod
DescriptionCreates 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
    NotesNone
    ExamplesNone
    Sourcesrc/extensions/cp/rx/AsyncSubject.lua line 43