首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

JavaScript学习札记(二十四) 模块创建构造函数

2013-09-05 
JavaScript学习笔记(二十四)模块创建构造函数 模块创建构造函数(Modules That Create Constructors)在前面

JavaScript学习笔记(二十四) 模块创建构造函数
 模块创建构造函数(Modules That Create Constructors)在前面的例子中,创建了一个MYAPP.utilities.array对象,但有时候使用构造函数创建你的对象更方便,你也可以使用模块模式实现它。唯一的不同就是在包裹模块的立即执行函数返回一个函数而不是对象。下面这个例子就是模块模式创建一个构造函数 MYAPP.utilities.Array

MYAPP.utilities.module = (function (app, global) {    // references to the global object    // and to the global app namespace object    // are now localized}(MYAPP, this));



热点排行
Bad Request.