Hello world

Package()
.define('Main', {
    print: function() {
        console.log('hello world!');
    }
}).run(function(cp) {
    cp.Main.print();
});
        

view source

inheritance

inheritance example

Package('test1')
.define('Parent', function(cp) { return Package.Class.extend({
    print: function() {
        console.log('print by parent');
    }
});});

Package('test2')
.use('test1.Parent')
.define('Child', function(cp) { return cp.Parent.extend({
    print: function() {
        console.log('print by child');
    },
    printByParent: function() {
        this.SUPER.print.apply(this, arguments);
    }
});});


Package()
.use('test2.Child')
.run(function(cp) {
    var c = new cp.Child();
    c.print();
    c.printByParent();
});
        

view source

transit

show you how to use TransitManager to control page redirect.

view source

twitter

show you how to implement an application like twitter use tupai.js.

view source

all examples

view source