Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
36 lines (24 sloc) 802 Bytes

Element

Element is a very rudimentary Backbone like view layer. It allows the user to create a view, define events and perform actions on that view. Element relies on vanilla javascript to interact with the dom.

example:

var element = require('./element');

var hello = element({

    events: {
        'click .hello': 'hello'
    }

    initialize: function () {
        this.render();
    }

    makeHello: function () {
        this.hello = document.createElement('div');
        this.el.appendChild(hello);
    }

    render: function () {
        this.makeHello();
    }

    hello: function (e) {
        this.hello.innerText = 'hello';
    }

});


new Hello({el: document.getElementsByTagName('body')})
You can’t perform that action at this time.