Last active
March 29, 2016 04:04
-
-
Save greggnakamura/27e810981e51afeb45e1 to your computer and use it in GitHub Desktop.
EmberJS: Ember.Object example
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
// emberjs cookbook: chapter2/example1/app/myObject.js | |
/* | |
Ember.Object is the base class for almost every other Ember object. | |
Routes, models, views, and components all inherit from Ember.Object. | |
It's used everywhere. | |
*/ | |
import Ember from 'ember'; | |
export default function() { | |
// create and extend class | |
const Light = Ember.Object.extend({ | |
isOn: false | |
}); | |
// create instance of class | |
const bulb = Light.create(); | |
// change property | |
bulb.set('isOn', true); | |
// access properties of `bulb` object | |
console.log(bulb.get('isOn')); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment