0.1.2 • Published 7 years ago
ember-deprecated v0.1.2
Ember-deprecated
Ember-deprecated makes it easy to warn developers about code that they shouldn't be using anymore
Installation
npm install --save-dev ember-deprecated
Deprecating Properties
If you have a type defined:
export default Ember.Object.extend({
firstName: '',
lastName: '',
fullName: function () {
return '%@ %@'.fmt(
this.get('firstName'),
this.get('lastName')
);
}.property('firstName', 'lastName')
});
You can just wrap the properties you wish to deprecate with deprecateProperty
import deprecateProperty from 'ember-deprecated/deprecate-property';
export default Ember.Object.extend({
firstName: '',
lastName: deprecateProperty(''),
fullName: deprecateProperty(function () {
return '%@ %@'.fmt(
this.get('firstName'),
this.get('lastName')
);
}.property('firstName', 'lastName'))
});
And you'll see something like this logged to the console
Deprecating Actions
if you have a controller
export default Ember.ObjectController.extend({
actions: {
submit: function () {
console.log('submit the datas!');
}
}
});
You can just wrap the actions you wish to deprecate with deprecateAction
import deprecateAction from 'ember-deprecated/deprecate-action';
export default Ember.ObjectController.extend({
actions: {
submit: deprecateAction(function () {
console.log('submit the datas!');
})
}
});
And you'll see something like this logged to the console once the action is invoked
Running Tests
ember test
ember test --server
Building
ember build
For more information on using ember-cli, visit http://www.ember-cli.com/.