js 模块化代码流程
来源:互联网 发布:软件项目实施费用 编辑:程序博客网 时间:2024/06/05 00:42
varModule = function(){
this.init();
};
// 初始化
Module.prototype.init = function(){
this.fetchData(function(){
// do something
});
};
// 绑定事件
Module.prototype.bindEvent = function(){
// ...
};
// 获取数据
Module.prototype.fetchData = function(cb){
varself = this;
ajax({}).then(function(data){
self.renderData(data);
}).catch(function(){
self._fetchDataFailed();
}).fin(function(){
cb && cb();
});
};
// 渲染数据
Module.prototype.renderData = function(data){
data = this._resolveData(data);
// ...
this.bindEvent();
};
// 处理数据
Module.prototype._resolveData = function(){
// ...
};
// 加载失败
Module.prototype._fetchDataFailed = function(){
// ...
};
1 0
- js 模块化代码流程
- 常用js模板代码-模块化
- JS 模块化
- 模块化js
- js模块化
- js模块化
- js模块化
- JS模块化
- js模块化
- js 模块化
- js模块化
- JS模块化
- JS模块化
- js模块化
- 代码模块化
- JS代码模块化(Module)是什么?为什么要模块化(module)?
- seajs模块化前端js代码1.hello world
- javascript代码模块化Demo(使用Require.js)
- 详细深入了解Framgent的生命周期,适合面试
- LAMP环境搭建
- ofbiz 的登录机制
- 一个Activity多个入口图标的实现方法
- iOS链式编程
- js 模块化代码流程
- servlet的生命周期 servlet和cgi的区别
- 转 screen widget 框架页面生成原理初探
- android 返回键的监听
- jsp页面使用${}不起作用
- iOS-仿QQ侧边栏
- android中ScrollView中TextView无法铺满全屏解决方案
- Ubuntu安装配置ftp
- git:could not open a connection to your authentication agent问题的解决(重新绑定私钥)