Function
deprecatingAlias (dependentKey, options) ComputedProperty public
Module: | @ember/object |
---|
Defined in packages/@ember/object/lib/computed/computed_macros.js:1152
Available since v1.7.0
import { deprecatingAlias } from '@ember/object/computed';
- dependentKey
- String
- options
- Object
- Options for `deprecate`.
- returns
- ComputedProperty
- computed property which creates an alias with a deprecation to the original value for property.
Creates a new property that is an alias for another property on an object. Calls to get
or set
this property behave as though they were called on the original property, but also print a deprecation warning.
Example:
import { set } from '@ember/object'; import { deprecatingAlias } from '@ember/object/computed'; class Hamster { @deprecatingAlias('cavendishCount', { id: 'hamster.deprecate-banana', until: '3.0.0' }) bananaCount; } let hamster = new Hamster(); set(hamster, 'bananaCount', 5); // Prints a deprecation warning. hamster.cavendishCount; // 5
Classic Class Example:
import EmberObject, { set } from '@ember/object'; import { deprecatingAlias } from '@ember/object/computed'; let Hamster = EmberObject.extend({ bananaCount: deprecatingAlias('cavendishCount', { id: 'hamster.deprecate-banana', until: '3.0.0' }) }); let hamster = Hamster.create(); set(hamster, 'bananaCount', 5); // Prints a deprecation warning. hamster.cavendishCount; // 5
© 2020 Yehuda Katz, Tom Dale and Ember.js contributors
Licensed under the MIT License.
https://api.emberjs.com/ember/3.25/functions/@ember%2Fobject%2Fcomputed/deprecatingAlias