Ember latest Template

by krisselden

HTML

<script src="http://cloud.github.com/downloads/wycats/handlebars.js/handlebars-1.0.0.beta.6.js"></script>
<script src="http://cloud.github.com/downloads/emberjs/ember.js/ember-latest.js"></script>

JavaScript

function log() {
    var m = [],
        i;
    for (i = 0; i < arguments.length; i++) {
        m.push(String(arguments[i]));
    }
    $(document.body).append($('<p></p>').text(m.join(' ')));
}

window.App = {};

function Box() {
    this.init.apply(this, arguments);
}

Box.PrototypeMixin = Ember.Mixin.create({
    width: null,
    height: null,
    area: function() {
        return this.width * this.height;
    }.property('width', 'height'),
    init: function(width, height) {
        this.width = width;
        this.height = height;
    }
});

Box.PrototypeMixin.apply(Box.prototype);

function Cube() {
    this.init.apply(this, arguments);
}

Cube.PrototypeMixin = Ember.Mixin.create({
    depth: null,
    area: function() {
        return this.width * this.height * this.depth;
    }.property('width', 'height', 'depth'),
    init: function(width, height, depth) {
        this._super(width, height);
        this.depth = depth;
    }
});

Cube.prototype = Object.create(Box.prototype);
Cube.prototype.constructor = Cube;


Cube.PrototypeMixin.apply(Cube.prototype);

window.Box = Box;
window.Cube = Cube;