Skip to main content

Observable

new Observable()

Source:
typedefs/Observable.js, line 2

Methods

forEach(onNextnullable, onErrornullable, onCompletednullable) → {Subscription}

The forEach method is a synonym for Observable.prototype.subscribe and 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 forEach 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 & Attributes Type Description
onNext
nullable
Observable~onNextCallback

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

onError
nullable
Observable~onErrorCallback

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

onCompleted
nullable
Observable~onCompletedCallback

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

Source:
typedefs/Observable.js, line 6
Return Type:
Subscription

forEach(onNextnullable, onErrornullable, onCompletednullable) → {Subscription}

The subscribe method is a synonym for Observable.prototype.forEach and 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 forEach 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 & Attributes Type Description
onNext
nullable
Observable~onNextCallback

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

onError
nullable
Observable~onErrorCallback

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

onCompleted
nullable
Observable~onCompletedCallback

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

Source:
typedefs/Observable.js, line 17
Return Type:
Subscription

Type Definitions

onCompletedCallback()

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

Source:
typedefs/Observable.js, line 40

onErrorCallback(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~onNextCallback.

Parameters:
Name Type Description
error Error

the error that occurred while evaluating the operation underlying the Observable

Source:
typedefs/Observable.js, line 34

onNextCallback(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:
typedefs/Observable.js, line 28