Ext.app.Application

来源:互联网 发布:免实名域名注册 编辑:程序博客网 时间:2024/05/16 18:50

继承:
Ext.Base - Ext.app.Controller - Ext.app.Application


Ext.app.Application定义Model,Controller,Profile,Store和View的集合,自动加载所有依赖的项目,所有都OK以后将调用launch函数。
Ext.application({
    name: 'MyApp',

    models: ['User', 'Group'],
    stores: ['Users'],
    controllers: ['Users'],
    views: ['Main', 'ShowUser'],

    launch: function() {
        Ext.create('MyApp.view.Main');
    }
});
创建Application的实例是在Sencha Touch中唯一不使用Ext.create创建新实例的地方。Ext.application函数创建Ext.app.Application实例。自动加载Ext.app.Application类。内部使用Ext.create并回调Ext.onReady函数。

依赖:
app/model/User.js
app/model/Group.js
app/store/User.js
app/controller/User.js
app/view/Main.js
app/view/ShowUser.js
嵌套依赖:
Ext.application({
    name: 'MyApp',

    controllers: ['Users', 'nested.MyController'],
    views: ['products.Show', 'products.Edit', 'user.Login']
});

app/controller/User.js
app/controller/nested/MyController.js
app/view/products/Show.js
app/view/products/Edit.js
app/view/user/Login.js
外部依赖:
Ext.Loader.setPath({
    'Auth': 'Auth'
});

Ext.application({
    views: ['Auth.view.LoginForm', 'Welcome'],
    controllers: ['Auth.controller.Sessions', 'Main'],
    models: ['Auth.model.User']
});
Auth/view/LoginForm.js
Auth/controller/Sessions.js
Auth/model/User.js
app/view/Welcome.js
app/controller/Main.js


Launching:
1.Controller#init调用
2.Profile#launch调用
3.Application#launch调用
4.Controller#launch调用

Adding to Home Screen:
Ext.application({
    name: 'MyApp',

    icon: 'resources/img/icon.png',
    glossOnIcon: false,
    phoneStartupScreen: 'resources/img/phone_startup.png',
    tabletStartupScreen: 'resources/img/tablet_startup.png'
});


Config:
appFolder:String 包含应用程序所有类的目录。这个路径通过Ext.Loader.setPath注册,默认为app。
application:Ext.app.Application
before:Object

原创粉丝点击