MDN self-hosted library · e01.org

Subscriber: next() method

Observable API

no runnable cells web-api-instance-method upstream source

Observable API

The next() method of the Subscriber interface sends a value to each observer of the subscription, invoking its next callback synchronously. These callbacks are supplied to Observable.subscribe().

Syntax

next(value)

Parameters

  • value
  • : The value to send to observers. This can be any JavaScript value.

Return value

None (undefined).

Description

If the subscriber is no longer active, this method does nothing. An exception thrown by an observer's next callback is reported to the global object; it does not call that observer's error callback or stop delivery to other observers.

[!NOTE] This shared-subscription behavior may change. A proposal to give each observer its own Subscriber would make each subscription start a separate execution instead of reusing an active subscription.

Examples

See the main Subscriber reference page for a basic example, and Creating custom observables for additional examples.

Specifications

Browser compatibility

See also