Skip to content

Commit

Permalink
[OCTANE] [CHORE] Quickstart JS to use Class Syntax ember-learn#541
Browse files Browse the repository at this point in the history
1. Change Route example to class syntax in core concepts
2. Change PeopleList component to use class syntax
3. didRender example to class syntax
  • Loading branch information
Rajasegar committed Mar 1, 2019
1 parent df50bf9 commit c6f5039
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
6 changes: 3 additions & 3 deletions guides/release/getting-started/core-concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ In the following example, the [`didRender()`](https://emberjs.com/api/ember/rele
```javascript {data-filename=/app/components/foo-did-render-example.js}
import Component from '@ember/component';

export default Component.extend({
export default class FooDidRenderExample extends Component {
didRender() {
this._super(...arguments);
super(...arguments);
console.log('I rendered!');
}
});
}
```
15 changes: 7 additions & 8 deletions guides/release/getting-started/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ We'll take the code created for us by the generator and add a `model()` method t
```javascript {data-filename="app/routes/scientists.js" data-diff="+4,+5,+6"}
import Route from '@ember/routing/route';

export default Route.extend({
export default class ScientistsRoute extends Route {
model() {
return ['Marie Curie', 'Mae Jemison', 'Albert Hofmann'];
}
});
}
```

This code example uses the latest features in JavaScript,
Expand Down Expand Up @@ -251,13 +251,12 @@ In the component, add an `actions` object with a `showPerson` function that aler
```javascript {data-filename="app/components/people-list.js" data-diff="+4,+5,+6,+7,+8"}
import Component from '@ember/component';

export default Component.extend({
actions: {
showPerson(person) {
alert(person);
}
export default class PeopleList extends Component {
@action
showPerson(person) {
alert(person);
}
});
}
```

Now in the browser when a scientist's name is clicked,
Expand Down

0 comments on commit c6f5039

Please sign in to comment.