Last active
February 29, 2016 21:15
-
-
Save hjumeau/4b3f9ce940d49d09b289 to your computer and use it in GitHub Desktop.
classesAndInstances
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'; | |
var Person = Ember.Object.extend({ | |
say(thing) { | |
var name = this.get('name'); | |
alert(`${name} says: ${thing}`); | |
} | |
}); | |
var Soldier = Person.extend({ | |
say(thing) { | |
// this will call the method in the parent class (Person#say), appending | |
// the string ', sir!' to the variable `thing` passed in | |
this._super(`${thing}, sir!`); | |
} | |
}); | |
var yehuda = Soldier.create({ | |
name: 'Yehuda Katz' | |
}); | |
yehuda.say('Yes'); | |
yehuda.set('age', 34); | |
document.write(yehuda.get('age')); |
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.5.0", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.3.1", | |
"ember-data": "2.3.3", | |
"ember-template-compiler": "2.3.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment