Last active
November 22, 2018 15:08
-
-
Save piotrpalek/4da0308e741adbfd50229a73ba6ec464 to your computer and use it in GitHub Desktop.
rekruExample
This file contains 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.Component.extend({ | |
value: '', | |
collectedValues: [], | |
actions: { | |
keyUp(event) { | |
this.set('value', event.target.value); | |
// if enter | |
if(event.keyCode === 13) { | |
this.get('collectedValues').pushObject(event.target.value); | |
this.set('value', ''); | |
} | |
}, | |
clear() { | |
this.set('collectedValues', []); | |
} | |
} | |
}); |
This file contains 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.Component.extend({ | |
headCount: null, | |
eyeCount: null, | |
legCount: null, | |
canBreathFire: false, | |
canFreeze: false, | |
canPetrify: false, | |
level: 1, | |
victories: [], | |
isDragon: Ember.computed('canBreathFire', function() { | |
return this.get('canBreathFire') && this.get('headCount') > 1; | |
}), | |
isFake: Ember.computed('canBreathFire', 'canFreeze', 'canPetrify', function() { | |
const hasDeadlyPower = this.get('canBreathFire') || this.get('canFreeze') || this.get('canPetrify'); | |
return !hasDeadlyPower; | |
}), | |
xp: Ember.computed('[email protected]', function() { | |
let xp = this.get('victories').reduce(function(totalXP, victory) { | |
return totalXP + victory.get('xp'); | |
}, 0); | |
if (xp > 10) { | |
this.set('level', 2); | |
} | |
}) | |
}); |
This file contains 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({ | |
appName: 'Ember Twiddle' | |
}); |
This file contains 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 config from './config/environment'; | |
const Router = Ember.Router.extend({ | |
location: 'none', | |
rootURL: config.rootURL | |
}); | |
Router.map(function() { | |
this.route('collector'); | |
}); | |
export default Router; |
This file contains 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": { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment