Function

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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { deprecatingAlias } from '@ember/object/computed';
import EmberObject from '@ember/object';

let Hamster = EmberObject.extend({
  bananaCount: deprecatingAlias('cavendishCount', {
    id: 'hamster.deprecate-banana',
    until: '3.0.0'
  })
});

let hamster = Hamster.create();

hamster.set('bananaCount', 5); // Prints a deprecation warning.
hamster.get('cavendishCount'); // 5