Skip to content

Commit 3cc8318

Browse files
authored
Remove last ember-array using in docs (#888)
1 parent fd6eb70 commit 3cc8318

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

docs/app/components/snippets/custom-position-2.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import Component from '@glimmer/component';
2-
import { A } from '@ember/array';
2+
import { tracked } from '@glimmer/tracking';
33
import { task, timeout } from 'ember-concurrency';
44

5-
const names = ['Katie', 'Ricardo', 'Igor', 'Alex', 'Martin', 'Godfrey'];
5+
const NAMES = ['Katie', 'Ricardo', 'Igor', 'Alex', 'Martin', 'Godfrey'];
66

77
export default class extends Component {
8-
names = [];
8+
@tracked names = [];
99

1010
calculatePosition(trigger, content) {
1111
let { top, left, width, height } = trigger.getBoundingClientRect();
@@ -19,9 +19,9 @@ export default class extends Component {
1919
}
2020

2121
@task(function* () {
22-
this.names = A([]);
23-
for (let name of names) {
24-
this.names.pushObject(name);
22+
this.names = [];
23+
for (let name of NAMES) {
24+
this.names = [...this.names, name];
2525
yield timeout(750);
2626
}
2727
})

docs/app/controllers/public-pages/docs/custom-position.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
import { set } from '@ember/object';
2-
import { A } from '@ember/array';
31
import Controller from '@ember/controller';
2+
import { tracked } from '@glimmer/tracking';
43
import { task, timeout } from 'ember-concurrency';
54
import CustomPosition1Component from '../../../components/snippets/custom-position-1';
65
import CustomPosition2Component from '../../../components/snippets/custom-position-2';
76

8-
const names = ['Katie', 'Ricardo', 'Igor', 'Alex', 'Martin', 'Godfrey'];
7+
const NAMES = ['Katie', 'Ricardo', 'Igor', 'Alex', 'Martin', 'Godfrey'];
98

109
export default class extends Controller {
1110
customPosition1Component = CustomPosition1Component;
1211
customPosition2Component = CustomPosition2Component;
1312

14-
names = [];
13+
@tracked names = [];
1514

1615
calculatePosition(trigger, content) {
1716
let { top, left, width, height } = trigger.getBoundingClientRect();
@@ -25,9 +24,9 @@ export default class extends Controller {
2524
}
2625

2726
@task(function* () {
28-
set(this, 'names', A([]));
29-
for (let name of names) {
30-
this.names.pushObject(name);
27+
this.names = [];
28+
for (let name of NAMES) {
29+
this.names = [...this.names, name];
3130
yield timeout(750);
3231
}
3332
})

0 commit comments

Comments
 (0)