Skip to content

Commit

Permalink
Remove last ember-array using in docs (#888)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkszepp authored May 6, 2024
1 parent fd6eb70 commit 3cc8318
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
12 changes: 6 additions & 6 deletions docs/app/components/snippets/custom-position-2.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import Component from '@glimmer/component';
import { A } from '@ember/array';
import { tracked } from '@glimmer/tracking';
import { task, timeout } from 'ember-concurrency';

const names = ['Katie', 'Ricardo', 'Igor', 'Alex', 'Martin', 'Godfrey'];
const NAMES = ['Katie', 'Ricardo', 'Igor', 'Alex', 'Martin', 'Godfrey'];

export default class extends Component {
names = [];
@tracked names = [];

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

@task(function* () {
this.names = A([]);
for (let name of names) {
this.names.pushObject(name);
this.names = [];
for (let name of NAMES) {
this.names = [...this.names, name];
yield timeout(750);
}
})
Expand Down
13 changes: 6 additions & 7 deletions docs/app/controllers/public-pages/docs/custom-position.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import { set } from '@ember/object';
import { A } from '@ember/array';
import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';
import { task, timeout } from 'ember-concurrency';
import CustomPosition1Component from '../../../components/snippets/custom-position-1';
import CustomPosition2Component from '../../../components/snippets/custom-position-2';

const names = ['Katie', 'Ricardo', 'Igor', 'Alex', 'Martin', 'Godfrey'];
const NAMES = ['Katie', 'Ricardo', 'Igor', 'Alex', 'Martin', 'Godfrey'];

export default class extends Controller {
customPosition1Component = CustomPosition1Component;
customPosition2Component = CustomPosition2Component;

names = [];
@tracked names = [];

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

@task(function* () {
set(this, 'names', A([]));
for (let name of names) {
this.names.pushObject(name);
this.names = [];
for (let name of NAMES) {
this.names = [...this.names, name];
yield timeout(750);
}
})
Expand Down

0 comments on commit 3cc8318

Please sign in to comment.