JSFiddle - React, Tailwind, and code Playground

by mediastuttgart

HTML

<script src="https://github.com/downloads/emberjs/ember.js/ember-0.9.5.min.js"></script>

JavaScript

// App
App = Ember.Application.create();

// Core controller
App.Controller = Ember.ArrayController.extend({
    qux : 'init'
});

// Sub controller
App.Controller.Foo = new App.Controller();

// Foo controller
App.Controller.Foo.reopen({
        // init is not called on reopen? *
        init : function () {
                Ember.Logger.log(this.get('qux'))
      
                this.addObserver('qux', function () {
                        App.Controller.Bar.baz();
                });

                $(window).bind('resize', function () {
                        App.Controller.Foo.set('qux', 1280);
                });
        }
});

// Bar controller inheritance
App.Controller.Bar = App.Controller.Foo.reopen({
        baz : function () {
                Ember.Logger.log(this.get('qux'));
        }
});

// * call manually because init is not called on reopen?
App.Controller.Foo.init();