Back to Rxjs

This is RxJS v 4. Find the latest version here

doc/api/core/operators/ofarraychanges.md

4.1.01.4 KB
Original Source

This is RxJS v 4. Find the latest version here

Rx.Observable.ofArrayChanges(array)

Creates an Observable sequence from changes to an array using Array.observe.

Arguments

  1. array (Array): The array to observe changes using Array.observe

Returns

(Observable): An observable sequence containing changes to an array from Array.observe.

Example

js
var arr = [1,2,3];
var source = Rx.Observable.ofArrayChanges(arr);

var subscription = source.subscribe(
  function (x) {
    console.log('Next: %s', x);
  },
  function (err) {
    console.log('Error: %s', err);
  },
  function () {
    console.log('Completed');
  });

arr.push(4);

// => Next: {type: "splice", object: Array[4], index: 3, removed: Array[0], addedCount: 1}

Location

File:

Dist:

Prerequisites:

  • None

NPM Packages:

  • None

NuGet Packages:

Unit Tests: