Skip to content

Commit fbdeb5e

Browse files
authored
Merge pull request #2155 from NullVoxPopuli/guides-source-2
6.8: Swap tracked-built-ins for the now included `@ember/reactive/collections`
2 parents cfb679e + c5048b1 commit fbdeb5e

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

guides/release/configuring-ember/disabling-prototype-extensions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ native arrays with things like a template's `{{#each}}` helper, Ember.js
4141
will have no way to detect changes to the array and the template will
4242
not update as the underlying array changes.
4343

44-
You can restore automatic tracking of changes by replacing your native array with a `TrackedArray` from the 'tracked-built-ins' library.
44+
You can restore automatic tracking of changes by replacing your native array with a `trackedArray` from [@ember/reactive/collections](https://api.emberjs.com/ember/release/modules/@ember%2Freactive%2Fcollections).
4545

4646
```javascript
47-
import { TrackedArray } from '@glimmer/tracking';
47+
import { trackedArray } from '@ember/reactive/collections';
4848

4949
class Ocean {
50-
islands = new TrackedArray(['Oahu', 'Kauai']);
50+
islands = trackedArray(['Oahu', 'Kauai']);
5151

5252
addIsland(newIsland) {
5353
this.islands.push(newIsland);

guides/release/in-depth-topics/autotracking-in-depth.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -322,12 +322,12 @@ Generally, you should try to create classes with their tracked properties
322322
enumerated and decorated with `@tracked`, instead of relying on dynamically
323323
created POJOs. In some cases however, if your usage of properties on POJOs is
324324
too dynamic, you may not be able to enumerate every single property that could
325-
be tracked. In this case, you can use `TrackedObject` from `tracked-built-ins`:
325+
be tracked. In this case, you can use `trackedObject` from [@ember/reactive/collections](https://api.emberjs.com/ember/release/modules/@ember%2Freactive%2Fcollections):
326326

327327
```js
328-
import { TrackedObject } from 'tracked-built-ins';
328+
import { trackedObject } from '@ember/reactive/collections';
329329

330-
let obj = new TrackedObject({
330+
let obj = trackedObject({
331331
a: 1,
332332
b: 2,
333333
})
@@ -337,29 +337,29 @@ obj.c = 3;
337337
```
338338

339339
All property reading and writing on this object is automatically tracked.
340-
`TrackedObject` is "shallowly" tracked. `obj.c = 4` would be tracked, but
340+
`trackedObject` is "shallowly" tracked. `obj.c = 4` would be tracked, but
341341
`obj.c.somethingDeeper = 5` would not be tracked unless you've also made sure
342-
that the contents of `obj.c` is itself another `TrackedObject`.
342+
that the contents of `obj.c` is itself another `trackedObject`.
343343

344344

345345
#### Arrays
346346

347-
When you want to track the contents of an Array, you can use `TrackedArray` from
348-
`tracked-built-ins`:
347+
When you want to track the contents of an Array, you can use `trackedArray` from [@ember/reactive/collections](https://api.emberjs.com/ember/release/modules/@ember%2Freactive%2Fcollections):
348+
349349

350350
```js
351-
import { TrackedArray } from 'tracked-built-ins';
351+
import { trackedArray } from '@ember/reactive/collections';
352352

353353
class ShoppingList {
354-
items = new TrackedArray([]);
354+
items = trackedArray([]);
355355

356356
addItem(item) {
357357
this.items.push(item);
358358
}
359359
}
360360
```
361361

362-
`TrackedArray` supports all the normal native `Array` methods, ensuring that
362+
`trackedArray` supports all the normal native `Array` methods, ensuring that
363363
their reads and writes are tracked.
364364

365365
## Caching of tracked properties

guides/release/services/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ Like any Ember object, a service is initialized and can have properties and meth
3333
Below, the shopping cart service manages an items array that represents the items currently in the shopping cart.
3434

3535
```javascript {data-filename=app/services/shopping-cart.js}
36-
import { TrackedArray } from 'tracked-built-ins';
3736
import Service from '@ember/service';
37+
import { trackedArray } from '@ember/reactive/collections';
3838

3939
export default class ShoppingCartService extends Service {
40-
items = new TrackedArray([]);
40+
items = trackedArray([]);
4141

4242
add(item) {
4343
this.items.push(item);

guides/release/typescript/core-concepts/services.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ Let's take this example from elsewhere in the [Ember Guides][example-location]:
66

77
```typescript {data-filename="app/services/shopping-cart.ts"}
88
import Service from '@ember/service';
9-
import { TrackedSet } from 'tracked-built-ins';
9+
import { trackedSet } from '@ember/reactive/collections';
1010

1111
export default class ShoppingCartService extends Service {
12-
items = new TrackedSet();
12+
items = trackedSet();
1313

1414
add(item) {
1515
this.items.add(item);

0 commit comments

Comments
 (0)