Skip to content

Commit 042e46c

Browse files
committed
Update handling-deprecations.md
1 parent 6903ba9 commit 042e46c

File tree

2 files changed

+36
-42
lines changed

2 files changed

+36
-42
lines changed

guides/v3.5.0/configuring-ember/handling-deprecations.md

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,45 +9,42 @@ Fortunately, Ember provides a way for projects to deal with deprecations in an o
99

1010
## Filtering Deprecations
1111

12-
When your project has a lot of deprecations, you can start by filtering out deprecations that do not have to be addressed right away. You
13-
can use the [deprecation handlers](https://emberjs.com/api/ember/2.15/classes/Ember.Debug/methods/registerDeprecationHandler?anchor=registerDeprecationHandler) API to check for what
14-
release a deprecated feature will be removed. An example handler is shown below that filters out all deprecations that are not going away
15-
in release 2.0.0.
16-
12+
When your project has a lot of deprecations, you can start by filtering out deprecations that do not have to be addressed right away.
13+
You can use the [deprecation handlers](https://www.emberjs.com/api/ember/release/functions/@ember%2Fdebug/registerDeprecationHandler) API to check for what release a deprecated feature will be removed.
14+
An example handler is shown below that filters out all deprecations that are not going away in release 2.0.0.
1715

1816
```javascript {data-filename= app/initializers/main.js}
1917
import Ember from 'ember';
18+
import { registerDeprecationHandler } from '@ember/debug';
2019

2120
export function initialize() {
22-
if (Ember.Debug && typeof Ember.Debug.registerDeprecationHandler === 'function') {
23-
Ember.Debug.registerDeprecationHandler((message, options, next) => {
24-
if (options && options.until && options.until !== '2.0.0') {
25-
return;
26-
} else {
27-
next(message, options);
28-
}
29-
});
30-
}
21+
registerDeprecationHandler((message, options, next) => {
22+
if (options && options.until && options.until !== '2.0.0') {
23+
return;
24+
} else {
25+
next(message, options);
26+
}
27+
});
3128
}
3229

3330
export default { initialize };
3431
```
3532

36-
The deprecation handler API was released in Ember 2.1. If you would like to leverage this API in a prior release of Ember you can install
37-
the [ember-debug-handlers-polyfill](http://emberobserver.com/addons/ember-debug-handlers-polyfill) addon into your project.
33+
The deprecation handler API was released in Ember 2.1.
34+
If you would like to leverage this API in a prior release of Ember you can install the [ember-debug-handlers-polyfill](http://emberobserver.com/addons/ember-debug-handlers-polyfill) addon into your project.
3835

3936
## Deprecation Workflow
4037

41-
Once you've removed deprecations that you may not need to immediately address, you may still be left with many deprecations. Also, your remaining
42-
deprecations may only occur in very specific scenarios that are not obvious. How then should you go about finding and fixing these? This
43-
is where the [ember-cli-deprecation-workflow](http://emberobserver.com/addons/ember-cli-deprecation-workflow) addon can be extremely helpful.
38+
Once you've removed deprecations that you may not need to immediately address, you may still be left with many deprecations.
39+
Also, your remaining deprecations may only occur in very specific scenarios that are not obvious.
40+
How then should you go about finding and fixing these?
41+
This is where the [ember-cli-deprecation-workflow](http://emberobserver.com/addons/ember-cli-deprecation-workflow) addon can be extremely helpful.
4442

4543
Once installed, the addon works in 3 steps:
4644

4745
### 1. Gather deprecations into one source
4846

49-
The ember-cli-deprecation-workflow addon provides a command that will collect deprecations from your console and generate JavaScript code listing
50-
its findings.
47+
The `ember-cli-deprecation-workflow` addon provides a command that will collect deprecations from your console and generate JavaScript code listing its findings.
5148

5249
To collect deprecations, first run your in-browser test suite by starting your development server and navigating to [`http://localhost:4200/tests`](http://localhost:4200/tests). If your test suite isn't fully covering your app's functionality, you may also
5350
manually exercise functionality within your app where needed. Once you've exercised the app to your satisfaction, run the following command within

guides/v3.6.0/configuring-ember/handling-deprecations.md

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,45 +9,42 @@ Fortunately, Ember provides a way for projects to deal with deprecations in an o
99

1010
## Filtering Deprecations
1111

12-
When your project has a lot of deprecations, you can start by filtering out deprecations that do not have to be addressed right away. You
13-
can use the [deprecation handlers](https://emberjs.com/api/ember/2.15/classes/Ember.Debug/methods/registerDeprecationHandler?anchor=registerDeprecationHandler) API to check for what
14-
release a deprecated feature will be removed. An example handler is shown below that filters out all deprecations that are not going away
15-
in release 2.0.0.
16-
12+
When your project has a lot of deprecations, you can start by filtering out deprecations that do not have to be addressed right away.
13+
You can use the [deprecation handlers](https://www.emberjs.com/api/ember/release/functions/@ember%2Fdebug/registerDeprecationHandler) API to check for what release a deprecated feature will be removed.
14+
An example handler is shown below that filters out all deprecations that are not going away in release 2.0.0.
1715

1816
```javascript {data-filename= app/initializers/main.js}
1917
import Ember from 'ember';
18+
import { registerDeprecationHandler } from '@ember/debug';
2019

2120
export function initialize() {
22-
if (Ember.Debug && typeof Ember.Debug.registerDeprecationHandler === 'function') {
23-
Ember.Debug.registerDeprecationHandler((message, options, next) => {
24-
if (options && options.until && options.until !== '2.0.0') {
25-
return;
26-
} else {
27-
next(message, options);
28-
}
29-
});
30-
}
21+
registerDeprecationHandler((message, options, next) => {
22+
if (options && options.until && options.until !== '2.0.0') {
23+
return;
24+
} else {
25+
next(message, options);
26+
}
27+
});
3128
}
3229

3330
export default { initialize };
3431
```
3532

36-
The deprecation handler API was released in Ember 2.1. If you would like to leverage this API in a prior release of Ember you can install
37-
the [ember-debug-handlers-polyfill](http://emberobserver.com/addons/ember-debug-handlers-polyfill) addon into your project.
33+
The deprecation handler API was released in Ember 2.1.
34+
If you would like to leverage this API in a prior release of Ember you can install the [ember-debug-handlers-polyfill](http://emberobserver.com/addons/ember-debug-handlers-polyfill) addon into your project.
3835

3936
## Deprecation Workflow
4037

41-
Once you've removed deprecations that you may not need to immediately address, you may still be left with many deprecations. Also, your remaining
42-
deprecations may only occur in very specific scenarios that are not obvious. How then should you go about finding and fixing these? This
43-
is where the [ember-cli-deprecation-workflow](http://emberobserver.com/addons/ember-cli-deprecation-workflow) addon can be extremely helpful.
38+
Once you've removed deprecations that you may not need to immediately address, you may still be left with many deprecations.
39+
Also, your remaining deprecations may only occur in very specific scenarios that are not obvious.
40+
How then should you go about finding and fixing these?
41+
This is where the [ember-cli-deprecation-workflow](http://emberobserver.com/addons/ember-cli-deprecation-workflow) addon can be extremely helpful.
4442

4543
Once installed, the addon works in 3 steps:
4644

4745
### 1. Gather deprecations into one source
4846

49-
The ember-cli-deprecation-workflow addon provides a command that will collect deprecations from your console and generate JavaScript code listing
50-
its findings.
47+
The `ember-cli-deprecation-workflow` addon provides a command that will collect deprecations from your console and generate JavaScript code listing its findings.
5148

5249
To collect deprecations, first run your in-browser test suite by starting your development server and navigating to [`http://localhost:4200/tests`](http://localhost:4200/tests). If your test suite isn't fully covering your app's functionality, you may also
5350
manually exercise functionality within your app where needed. Once you've exercised the app to your satisfaction, run the following command within

0 commit comments

Comments
 (0)