Ember.computed.deprecatingAlias()

deprecatingAlias (dependentKey, options) Ember.ComputedPropertypublic

Defined in packages/ember-runtime/lib/computed/computed_macros.js:619
Available since 1.7.0

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.

let Hamster = Ember.Object.extend({
  bananaCount: Ember.computed.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

Parameters:

dependentKey String
options Object
Options for `Ember.deprecate`.

Returns:

Ember.ComputedProperty
computed property which creates an alias with a deprecation to the original value for property.
doc_EmberJs
2016-11-30 16:51:13
Comments
Leave a Comment

Please login to continue.