Skip to content

Commit

Permalink
use file path and add imports
Browse files Browse the repository at this point in the history
Used RFC #176 modules API for imports.
  • Loading branch information
locks committed Jul 27, 2017
1 parent cefee2b commit 0d722c0
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 23 deletions.
2 changes: 1 addition & 1 deletion packages/ember-application/lib/system/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ Engine.reopenClass({
This must be a unique name, as trying to register two initializers with the
same name will result in an error.
```javascript
```app/initialize/named-initializer.js
Ember.Application.initializer({
name: 'namedInitializer',
Expand Down
18 changes: 11 additions & 7 deletions packages/ember-glimmer/lib/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,14 @@ var Helper = FrameworkObject.extend({
For example, this component will rerender when the `currentUser` on a
session service changes:
```js
// app/helpers/current-user-email.js
export default Ember.Helper.extend({
session: Ember.inject.service(),
onNewUser: Ember.observer('session.currentUser', function() {
```app/helpers/current-user-email.js
import Helper from "@ember/component/helper"
import { inject as service } from "@ember/service"
import { observer } from "@ember/object"
export default Helper.extend({
session: service(),
onNewUser: observer('session.currentUser', function() {
this.recompute();
}),
compute() {
Expand Down Expand Up @@ -105,8 +108,9 @@ Helper.reopenClass({
The `helper` method create pure-function helpers without instances. For
example:
```js
// app/helpers/format-currency.js
```app/helpers/format-currency.js
import { helper } from "@ember/component/helper";
export default Ember.Helper.helper(function(params, hash) {
let cents = params[0];
let currency = hash.currency;
Expand Down
7 changes: 4 additions & 3 deletions packages/ember-glimmer/lib/syntax/outlet.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,10 @@ function outletComponentFor(vm, args) {
Your routes can then render into a specific one of these `outlet`s by specifying the `outlet`
attribute in your `renderTemplate` function:
```javascript
// app/routes/menu.js
export default Ember.Route.extend({
```app/routes/menu.js
import Route from "@ember/routing/route";
export default Route.extend({
renderTemplate() {
this.render({ outlet: 'menu' });
}
Expand Down
28 changes: 16 additions & 12 deletions packages/ember-views/lib/mixins/action_support.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ export default Mixin.create({
into action notifications of "play" or "stop" depending on some internal state
of the component:
```javascript
// app/components/play-button.js
export default Ember.Component.extend({
```app/components/play-button.js
import Component from "@ember/component";
export default Component.extend({
click() {
if (this.get('isPlaying')) {
this.sendAction('play');
Expand All @@ -56,9 +57,10 @@ export default Mixin.create({
interaction into application-specific semantics ("play" or "stop") and
calls the specified action.
```javascript
// app/controller/application.js
export default Ember.Controller.extend({
```app/controller/application.js
import Controller from "@ember/controller";
export default Controller.extend({
actions: {
musicStarted() {
// called when the play button is clicked
Expand All @@ -75,9 +77,10 @@ export default Mixin.create({
If no action is passed to `sendAction` a default name of "action"
is assumed.
```javascript
// app/components/next-button.js
export default Ember.Component.extend({
```app/components/next-button.js
import Component from "@ember/component";
export default Component.extend({
click() {
this.sendAction();
}
Expand All @@ -89,9 +92,10 @@ export default Mixin.create({
{{next-button action=(action "playNextSongInAlbum")}}
```
```javascript
// app/controllers/application.js
App.ApplicationController = Ember.Controller.extend({
```app/controllers/application.js
import Controller from "@ember/controller";
export default Controller.extend({
actions: {
playNextSongInAlbum() {
...
Expand Down

0 comments on commit 0d722c0

Please sign in to comment.