Class: Observable

Observable

Methods

subscribe(nextnullable, errornullable, completednullable) → {Subscription}

The subscribe method triggers the execution of the Observable, causing the values within to be pushed to a callback. An Observable is like a pipe of water that is closed. When subscribe is called, we open the valve and the values within are pushed at us. These values can be received using either callbacks or an Observer object.

Parameters:
Name Type Attributes Description
next Observable~nextCallback <nullable>

a callback that accepts the next value in the stream of values

error Observable~errorCallback <nullable>

a callback that accepts an error that occurred while evaluating the operation underlying the Observable stream

completed Observable~completeCallback <nullable>

a callback that is invoked when the Observable stream has ended, and the Observable~nextCallback will not receive any more values

Source:
Returns:
Type
Subscription

Type Definitions

completeCallback()

This callback is invoked when the Observable stream ends. When this callback is invoked the Observable stream has ended, and therefore the Observable~nextCallback will not receive any more values.

Source:

errorCallback(error)

This callback accepts an error that occurred while evaluating the operation underlying the Observable stream. When this callback is invoked, the Observable stream ends and no more values will be received by the Observable~nextCallback.

Parameters:
Name Type Description
error Error

the error that occurred while evaluating the operation underlying the Observable

Source:

nextCallback(value)

This callback accepts a value that was emitted while evaluating the operation underlying the Observable stream.

Parameters:
Name Type Description
value Object

the value that was emitted while evaluating the operation underlying the Observable

Source: