JSFiddle - React, Tailwind, and code Playground

by krisselden

HTML

<script src="http://cloud.github.com/downloads/wycats/handlebars.js/handlebars-1.0.rc.1.js"></script>
<script src="http://cloud.github.com/downloads/emberjs/ember.js/ember-latest.js"></script>
<script type="text/x-handlebars">
    Hello {{App.container.fooController.barController.store.someProp}}
</script>

JavaScript

Ember.Container = Ember.CoreObject.extend({
    unknownProperty: function(key) {
        var Class = this.findClassForKey(key),
            value;
        if (Class) {
            value = this.createObject(Class, key);
            Ember.defineProperty(this, key, null, value);
            return value;
        }
    },

    findClassForKey: function(key) {
        // key starts with lowercase char
        var match = /^[a-z]/.exec(key),
            className;
        if (match) {
            className = match[0].toUpperCase() + key.slice(1);
            return this.findClass(className);
        }
    },

    findClass: function(className) {
        // TODO: search namespaces
        var Class = this.namespace[className];
        if (typeof Class === 'function') {
            return Class;
        }
    },

    getCreateInjections: function(Class, forKey) {
        var createInjections,
            container = this;
        if (this.injectionsByType) {
            this.injectionsByType.forEach(function(type, injections) {
                if ((type instanceof Ember.Mixin && type.detect(Class.PrototypeMixin)) || type.detect(Class)) {
                    if (!createInjections) {
                        createInjections = {};
                    }
                    injections.forEach(function(injection) {
                        createInjections[injection] = Ember.get(container, injection);
                    });
                }
            });
        }
        if (forKey) {
            if (this.injectionsByKey) {
                if (this.injectionsByKey.has(forKey)) {
                    if (!createInjections) {
                        createInjections = {};
                    }
                    var injections = this.injectionsByKey.get(forKey);
                    injections.forEach(function(injection) {
                        createInjections[injection] = Ember.get(container, injection);
                    });
                }
            }
        }
  ...