Javadream

A long way and a dream.

Ext 2 学习笔记(三):Ext模块

Posted on 2008-02-11 11:35 oxl 阅读(426) 评论(0)  编辑  收藏 所属分类: 技术感语
 1 // 定义一个模块,你可以像使用类一样使用它,你完全可以把它当成是类。
 2 // 它利用js的一些特性实现私有和公有,就和applayout.js中定义的名命空间一样。
 3 var module = function() {
 4     // 私有变量
 5     var message = 'Hello, Ext 2 beginner.';
 6     
 7     // 公用变量或函数
 8     return {
 9         name: 'oxl',
10         init: function() {
11             message += this.name;
12         },
13         
14         show: function() {
15             this.other();
16             alert(message);
17         },
18         
19         other: function() {
20             alert('Welcome to Ext 2\'s world.');
21         }
22     };
23 }();

只有注册用户登录后才能发表评论。


网站导航: