Découvrons spineJS

by abernier

HTML

<script src="http://cdnjs.cloudflare.com/ajax/libs/spinejs/0.0.4/spine.min.js"></script>
<script id="myapp" type="text/template">
foo
</script>

JavaScript

Myapp = Spine.Controller.create({
    init: function () {
        this.render();
        
        return this;
    },
    
    template: function () {
        return $('#myapp').tmpl();
    },

    render: function () {
        this.el.html(this.template());

        return this;
    }
});

Myapp.init({el: $('body')[0]});