Function

observer (propertyNames, func) public

Module: @ember/object
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/3.25/functions/@ember%2Fobject/observer