# cp.rx.Observer

Observers are simple objects that receive values from Observables.


# API Overview

Functions - API calls offered directly by the extension

  • is

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

# API Documentation

# Functions

# is

Signature cp.rx.Observer.is(thing) -> boolean
Type Function
Description Tests if the thing is an Observer.
Parameters
  • thing - The thing to test.
Returns
  • true if the thing is an Observer, otherwise false.
Notes None
Examples None
Source src/extensions/cp/rx/Observer.lua line 14

# Constructors

# create

Signature cp.rx.Observer.create(onNext, onError, onCompleted) -> cp.rx.Observer
Type Constructor
Description Creates a new Observer.
Parameters
  • onNext - Called when the Observable produces a value.
  • onError - Called when the Observable terminates due to an error.
  • onCompleted - Called when the Observable completes normally.
Returns
  • The new Observer.
Notes None
Examples None
Source src/extensions/cp/rx/Observer.lua line 27

# Methods

# onCompleted

Signature cp.rx.Observer:onCompleted() -> nil
Type Method
Description Notify the Observer that the sequence has completed and will produce no more values.
Parameters
  • None
Returns
  • Nothing
Notes None
Examples None
Source src/extensions/cp/rx/Observer.lua line 80

# onError

Signature cp.rx.Observer:onError(message) -> nil
Type Method
Description Notify the Observer that an error has occurred.
Parameters
  • message - A string describing what went wrong.
Returns
  • Nothing
Notes None
Examples None
Source src/extensions/cp/rx/Observer.lua line 64

# onNext

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