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.store.name}}
</script>

JavaScript

Ember.Container = Ember.CoreObject.extend({
    unknownProperty: function(key) {
        var match = /^[a-z]/.exec(key),
            name, Class, value;
        if (match) {
            name = match[0].toUpperCase() + key.slice(1);
            Class = this.namespace[name];
            if (typeof Class === 'function') {
                value = this.createObject(key, Class);
                Ember.defineProperty(this, key, null, value);
                return value;
            }
        }
    },

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

    registerInjection: function(opts) {
        if (opts.type) {
            if (!this.injectionsByType) {
                this.injectionsByType = new Ember.Map();
            }
            if (this.injectionsByType.has(opts.type)) {
                this.injectionsByType.get(opts.type).addObject(opts.inject);
            } else {
                this.injectionsByType.set(opts.type, [opts.inject]);
            }
        } else if (opts.key) {
            if (!this.injectionsByKey) {
                this.injectionsByKey = new Ember.Map();
            }
            if (this.injectionsByKey.has(opts.key)) {
        ...