1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
### `Rx.Observable.ofObjectChanges(obj)`
[Ⓢ](https://github.com/Reactive-Extensions/RxJS/blob/master/src/core/linq/observable/ofobjectchanges.js "View in source")
Creates an Observable sequence from changes to an object using `Object.observe`.
#### Arguments
1. `array` *(`Array`)*: The object to observe changes using `Object.observe`
#### Returns
*(`Observable`)*: An observable sequence containing changes to an object from `Object.observe`.
#### Example
```js
var obj = {x: 1};
var source = Rx.Observable.ofObjectChanges(obj);
var subscription = source.subscribe(
function (x) {
console.log('Next: %s', x);
},
function (err) {
console.log('Error: %s', err);
},
function () {
console.log('Completed');
});
obj.x = 42;
// => Next: {type: "update", object: Object, name: "x", oldValue: 1}
```
### Location
File:
- [`/src/core/linq/observable/ofobjectchanges.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/src/core/linq/observable/ofobjectchanges.js)
Dist:
- [`rx.all.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/dist/rx.all.js)
Prerequisites:
- None
NPM Packages:
- None
NuGet Packages:
- [`RxJS-Complete`](http://www.nuget.org/packages/RxJS-Complete)
Unit Tests:
- [`/tests/observable/ofarraychanges.js`](https://github.com/Reactive-Extensions/RxJS/blob/master/tests/observable/ofobjectchanges.js)
|