Skip to content

Commit 4ffb570

Browse files
authored
Merge pull request #1392 from ember-learn/kategengler-patch-1
Update deprecation guide for Array Prototype extensions
2 parents 8917059 + 2147549 commit 4ffb570

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

content/ember/v5/deprecate-array-prototype-extensions.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@ since: '5.10.0'
66

77
Ember historically extended the prototypes of native Javascript arrays to implement `Ember.Enumerable`, `Ember.MutableEnumerable`, `Ember.MutableArray`, `Ember.Array`. As of v5, the usages of array prototype extensions are deprecated.
88

9+
To disable the extention of array prototypes, in `config/environment.js`, ensure that `EXTEND_PROTOYPES` is set to false on EmberENV:
10+
11+
```js
12+
EmberENV: {
13+
EXTEND_PROTOTYPES: false,
14+
// ...
15+
},
16+
// ...
17+
```
18+
19+
Once it is set to false, audit your project for any breakage from the following methods no longer being available on native arrays. Exceptions will be thrown where they are in use:
20+
921
For convenient functions like `filterBy`, `compact`, you can directly convert to use native array methods.
1022

1123
For mutation functions (like `pushObject`, `replace`) or observable properties (`firstObject`, `lastObject`), in order to keep the reactivity, you should take following steps:

0 commit comments

Comments
 (0)