js模块化编码
来源:互联网 发布:ar技术应用于淘宝 编辑:程序博客网 时间:2024/06/05 08:52
var modula1 = (function() {
var a = "innerParam"; //内置参数,外部读取不到
function f1(x) {
x += '内置函数,外部不可调用';
console.log(x);
};
var f2 = function() {
f1(a);
console.log("返回这个函数")
};
var f3 = function() {
console.log('shuibianxiexie');
}
return {
f2: f2,
f3: f3
}
})();
modula1.f2(); //调用
//实现继承
var modula2 = (function(mode) {
var F = function(){};
F.prototype = mode;
F.prototype.constructor = F;
var fexaml = new F();
return fexaml;
})(modula1);
modula2.f4 = function(){
console.log("这是新增函数");
}
console.log(modula2);
modula2.f3();
//外部js调用时,可借助nodeJs或者requireJs
var a = "innerParam"; //内置参数,外部读取不到
function f1(x) {
x += '内置函数,外部不可调用';
console.log(x);
};
var f2 = function() {
f1(a);
console.log("返回这个函数")
};
var f3 = function() {
console.log('shuibianxiexie');
}
return {
f2: f2,
f3: f3
}
})();
modula1.f2(); //调用
//实现继承
var modula2 = (function(mode) {
var F = function(){};
F.prototype = mode;
F.prototype.constructor = F;
var fexaml = new F();
return fexaml;
})(modula1);
modula2.f4 = function(){
console.log("这是新增函数");
}
console.log(modula2);
modula2.f3();
//外部js调用时,可借助nodeJs或者requireJs
0 0
- js模块化编码
- JS 模块化
- 模块化js
- js模块化
- js模块化
- js模块化
- JS模块化
- js模块化
- js 模块化
- js模块化
- JS模块化
- JS模块化
- js模块化
- CSS技巧: 模块化编码
- 模块化编码借鉴
- js模块化的使用
- Js 模块化编程
- JS模块化编程
- TortoiseGit 配置密钥的图文教程
- unity与iOS之间的简单交互
- 网管的自我修养-服务器相关
- CentOS7安装Nagios并配置出图详解
- ZCMU-1626-计算面积
- js模块化编码
- vim 设置tab宽度
- 文件缓冲区测试实例及总结
- db2解锁及数据导入
- 元数据的使用
- 避免临时表,SQL语句性能提升100倍
- Bayesian Networks Independencies
- 安卓-ListActivity的使用
- 为什么我们要用cocoapods?