Created
March 30, 2017 02:38
-
-
Save alexdiliberto/3b27c95c5f6690e359b05695bb35a6db to your computer and use it in GitHub Desktop.
Spotlight: Ember Closure Actions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Ember from 'ember'; | |
| import { log } from '../log'; | |
| export default Ember.Component.extend({ | |
| actions: { | |
| hodorSigil() { | |
| log('HODOR!!!'); | |
| } | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Ember from 'ember'; | |
| import { log } from '../log'; | |
| export default Ember.Component.extend({ | |
| actions: { | |
| lannisterSigil() { | |
| log('Gold Lion'); | |
| } | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Ember from 'ember'; | |
| import { log } from '../log'; | |
| export default Ember.Component.extend({ | |
| actions: { | |
| starkSigil() { | |
| log('Grey Direwolf'); | |
| } | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Ember from 'ember'; | |
| export default Ember.Controller.extend({ | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function log() { | |
| var msg = [].slice.call(arguments).join(' '); | |
| let p = document.createElement("p"); | |
| let txt = document.createTextNode(msg); | |
| p.appendChild(txt); | |
| logs.insertBefore(p, logs.firstChild); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Ember from 'ember'; | |
| import { log } from '../log'; | |
| const characters = Ember.A([ | |
| Ember.Object.create({ | |
| id: 1, | |
| componentName: 'got-stark', | |
| name: 'Ned Stark', | |
| title: 'King of the North' | |
| }), | |
| Ember.Object.create({ | |
| id: 2, | |
| componentName: 'got-lannister', | |
| name: 'Jaime Lannister', | |
| title: 'Kingslayer' | |
| }), | |
| Ember.Object.create({ | |
| id: 3, | |
| componentName: 'got-hodor', | |
| name: 'Hodor', | |
| title: 'Hodor!' | |
| }) | |
| ]) | |
| export default Ember.Route.extend({ | |
| model() { | |
| return characters; | |
| }, | |
| actions: { | |
| error: function(error) { | |
| log(error.message); | |
| } | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| body { | |
| margin: 12px 16px; | |
| font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; | |
| font-size: 12pt; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "version": "0.12.1", | |
| "EmberENV": { | |
| "FEATURES": {} | |
| }, | |
| "options": { | |
| "use_pods": false, | |
| "enable-testing": false | |
| }, | |
| "dependencies": { | |
| "jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
| "ember": "2.12.0", | |
| "ember-template-compiler": "2.12.0", | |
| "ember-testing": "2.12.0" | |
| }, | |
| "addons": { | |
| "ember-data": "2.12.1" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment