Function
observer (propertyNames, func) public
Module: | @ember/object |
---|
Defined in packages/ember-metal/lib/mixin.js:735
import { observer } from '@ember/object';
- propertyNames
- String
- func
- Function
- returns
- func
Specify a method that observes property changes.
import EmberObject from '@ember/object'; import { observer } from '@ember/object'; export default EmberObject.extend({ valueObserver: observer('value', function() { // Executes whenever the "value" property changes }) });
Also available as Function.prototype.observes
if prototype extensions are enabled.
© 2020 Yehuda Katz, Tom Dale and Ember.js contributors
Licensed under the MIT License.
https://api.emberjs.com/ember/2.18/functions/@ember%2Fobject/observer