0.1.2 • Published 7 years ago

ember-deprecated v0.1.2

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

Ember-deprecated

Greenkeeper badge

Build Status Dependency Status devDependency Status Ember Observer Score Code Climate

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

http://i57.tinypic.com/2vsgu2e.png

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

http://i61.tinypic.com/oepzm.png

Running Tests

  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit http://www.ember-cli.com/.

0.1.2

7 years ago

0.1.1

9 years ago

0.1.0

9 years ago

0.0.1

10 years ago