Observable.observe(...)
allows options
parameter, third one, optional.
Some of the options are filtering ones, allowing to specify the changes of interest from within the observable graph. Here is a detailed description of those options.
Value expected to be a non-empty string representing a path, any changes of which and deeper will be delivered to the observer.
This option MAY NOT be used together with path
option.
|
Given, that we have subscribed for the changes via:
Observable.observe(o, callback, { pathsFrom: 'address' });
Following mutations will be delivered to the callback :
o.address.street.apt = 5;
o.address.city = 'DreamCity';
o.address = {};
Following mutations will not be delivered to the callback :
|
Value expected to be a string, which MAY be empty, representing a path. Changes to direct properties of which will be notified.
|
Given, that we have subscribed for the changes via:
Observable.observe(o, callback, { pathsOf: 'address' });
Following mutations will be delivered to the callback :
o.address.street = {};
o.address.city = 'DreamCity';
Following mutations will not be delivered to the callback :
o.lastName = 'Joker';
o.address = {};
o.address.street.apt = 5;
|
Value expected to be a non-empty string, representing a specific path to observe. Only a changes of this exact path will be notified.
|
Given, that we have subscribed for the changes via:
Observable.observe(o, callback, { path: 'address.street' });
Following mutations will be delivered to the callback :
Following mutations will not be delivered to the callback :
o.lastName = 'Joker';
o.address = {};
o.address.street.apt = 5;
|