Skip to content

tokuhirom/caym-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

caym.js

WHAT'S THIS?

This is yet another tiny javascript library for view/dispatcher.

VIEWS

var MyView = Caym.View.extend({
    init: function (arg1, arg2) {
        // constructor code here
    },
    el: $('#container'), // root container of this view
    elements: { // make element as instance property
        '.btn': 'btnElem'
    },
    events: { // bind events
        '.btn': {
            'click': 'onClickBtn'
        }
    },
    onClickBtn: function (event) {
        // event handler here
    }
});
window.myview = new MyView(arg1, arg2);

DISPATCHER

var dispatcher = new Caym.Dispatcher();
dispatcher.register('/my/', function () {
    // your code here
});
dispatcher.register('/user/:id', function (id) {
    // your code here
});
dispatcher.dispatch(location.pathname);

REQUIREMENTS

jQuery 1.7+

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published