Subscriber: next() method

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

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

js
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

Specification
Observable
# dom-subscriber-next

Browser compatibility

See also