Skip to content

Instantly share code, notes, and snippets.

@greggnakamura
Last active March 29, 2016 04:04
Show Gist options
  • Save greggnakamura/27e810981e51afeb45e1 to your computer and use it in GitHub Desktop.
Save greggnakamura/27e810981e51afeb45e1 to your computer and use it in GitHub Desktop.
EmberJS: Ember.Object example
// 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