<commit_before>---
title: Deprecations for v3.x
alias: guides/deprecations/
layout: deprecations
responsive: true
---

## Deprecations Added in Ember 3.x

What follows is a list of deprecations introduced to Ember.js during the 3.x
cycle.

For more information on deprecations in Ember, see the [main deprecations page]
(/deprecations).

### Deprecations Added in 3.1

#### Use notifyPropertyChange instead of propertyWillChange and propertyDidChange

##### until: 3.5.0
##### id: ember-metal.deprecate-propertyWillChange, ember-metal.deprecate-propertyDidChange

The private APIs `propertyWillChange` and `propertyDidChange` will be removed after the first
LTS of the 3.x cycle. You should remove any calls to `propertyWillChange` and replace any
calls to `propertyDidChange` with `notifyPropertyChange`. This applies to both the Ember global
version and the EmberObject method version.

For example, the following:

```javascript
Ember.propertyWillChange(object, 'someProperty');
doStuff(object);
Ember.propertyDidChange(object, 'someProperty');

object.propertyWillChange('someProperty');
doStuff(object);
object.propertyDidChange('someProperty');
```

Should be changed to:

```javascript
doStuff(object);
Ember.notifyPropertyChange(object, 'someProperty');

doStuff(object);
object.notifyPropertyChange('someProperty');
```

#### Getting the @each property

##### until: 3.5.0
##### id: ember-metal.getting-each

Calling `array.get('@each')` is deprecated. `@each` may only be used as dependency key.

### Deprecations Added in Upcoming Versions

#### Use console rather than Ember.Logger

##### until: 4.0.0
##### id: ember-console.deprecate-logger

The `Ember.Logger` module will be removed at the start of the 4.x cycle. You should remove any calls to `Ember.Logger` and use calls to `console` instead.

In Edge and IE11, uses of `console` beyond calling its methods may require more subtle changes than simply substituting `console` wherever `Logger` appears. In these browsers, they will behave just as they do in other browsers when your development tools window is open. However, when run normally, calls to its methods must not be bound to anything other than the console object or you will receive an `Invalid calling object` exception. This is a known inconsistency with these browsers. (Edge issue #14495220.)

To avoid this, transform the following usage:

``` javascript
var print = Logger.log; // assigning method to variable
```

to:

``` javascript
// assigning method bound to console to variable
var print = console.log.bind(console);
```

Also, transform any of the following:

``` javascript
Logger.info.apply(undefined, arguments); // or
Logger.info.apply(null, arguments); // or
Logger.info.apply(this, arguments); // or
```

to:

``` javascript
console.info.apply(console, arguments);
```

Finally, because Node versions before version 9 don't support `console.debug`, you may want to transform the following:

``` javascript
Logger.debug(message);
```

to:

``` javascript
if (console.debug) {
  console.debug(message);
} else {
  console.log(message);
}
```<commit_msg>Updated after comments by rwjblue<commit_after>---
title: Deprecations for v3.x
alias: guides/deprecations/
layout: deprecations
responsive: true
---

## Deprecations Added in Ember 3.x

What follows is a list of deprecations introduced to Ember.js during the 3.x
cycle.

For more information on deprecations in Ember, see the [main deprecations page]
(/deprecations).

### Deprecations Added in 3.1

#### Use notifyPropertyChange instead of propertyWillChange and propertyDidChange

##### until: 3.5.0
##### id: ember-metal.deprecate-propertyWillChange, ember-metal.deprecate-propertyDidChange

The private APIs `propertyWillChange` and `propertyDidChange` will be removed after the first
LTS of the 3.x cycle. You should remove any calls to `propertyWillChange` and replace any
calls to `propertyDidChange` with `notifyPropertyChange`. This applies to both the Ember global
version and the EmberObject method version.

For example, the following:

```javascript
Ember.propertyWillChange(object, 'someProperty');
doStuff(object);
Ember.propertyDidChange(object, 'someProperty');

object.propertyWillChange('someProperty');
doStuff(object);
object.propertyDidChange('someProperty');
```

Should be changed to:

```javascript
doStuff(object);
Ember.notifyPropertyChange(object, 'someProperty');

doStuff(object);
object.notifyPropertyChange('someProperty');
```

#### Getting the @each property

##### until: 3.5.0
##### id: ember-metal.getting-each

Calling `array.get('@each')` is deprecated. `@each` may only be used as dependency key.

### Deprecations Added in 3.2

#### Use console rather than Ember.Logger

##### until: 4.0.0
##### id: ember-console.deprecate-logger

The `Ember.Logger` module will be removed at the start of the 4.x cycle. You should remove any calls to `Ember.Logger` and use calls to `console` instead.

``` javascript
// Before
Ember.Logger.log('significant event occurred');

// After
console.log('significant event occurred');
```

###### Calling `console` methods unbound

In Edge and IE11, uses of `console` beyond calling its methods may require more subtle changes than simply substituting `console` wherever `Logger` appears. When the development tools window is open, these browsers will handle the console just as other browsers do. However, when run normally, calls to its methods must be bound to the console object or you will receive an `Invalid calling object` exception. This is a known inconsistency with these browsers. (Edge issue #14495220.)

You can address the issue by binding the method to the console object:

``` javascript
// Before - assigning raw method to a variable for later use
var print = Logger.log; // assigning method to variable
print('Message');

// After - assigning console-bound method to variable for later use
var print = console.log.bind(console);
print('Message');
```

In some cases, you can use rest parameter syntax to avoid the issue entirely:

``` javascript
// Before
Logger.info.apply(undefined, arguments); // or
Logger.info.apply(null, arguments); // or
Logger.info.apply(this, arguments); // or

// After
console.info(...arguments);
```

###### `console.debug` method not available in Node 8 and earlier

Because Node versions before version 9 don't support `console.debug`, you may want to either use `console.log`  instead or transform the usage as follows:

``` javascript
// Before
Logger.debug(message);

// After
if (console.debug) {
console.debug(message);
} else {
console.log(message);
}
```

###### Addons that support both 2.x and 3.x

If your add-on needs to support both Ember 2.x and Ember 3.x clients, you will
need to test for the existence of `console` before calling its methods. If you
do much logging, you may find it convenient to define your own wrapper. Writing
the wrapper as a service will provide for dependency injection by tests and
perhaps even clients.
{'fraction_non_alphanumeric': 0.10699411173344822, 'fraction_numerical': 0.008760591698980325, 'mean_word_length': 5.013816925734024, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '104838', 'n_tokens_mistral': 2037, 'n_tokens_neox': 1883, 'n_words': 800}