1 Star 0 Fork 117

lonson / xpmjs

forked from XpmJS / xpmjs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
xpm.js 926 Bytes
一键复制 编辑 原始数据 按行查看 历史
Weiping 提交于 2017-02-07 20:28 . Promise 兼容
function xpm( opt ) {
this.opt = opt || {};
this.getPromise = function(){
if ( typeof Promise == 'undefined' ) { var _Promise = require('lib/promise.min.js').Promise; } else { var _Promise = Promise }
return _Promise;
}
/**
* 载入服务文件
* @param {[type]} service_name [description]
* @param {[type]} params [description]
* @return {[type]} [description]
*/
this.require = function ( service_name, params ) {
var se = require( 'service' + '/' + service_name.toLowerCase() + '.js' );
params = params || {};
return new se( this.opt , params);
}
/**
* 设定配置信息
* @param array option 设置或读取配置信息
* @return this / option = null return option
*/
this.option = function ( option ) {
if ( typeof option != 'undefined' ) {
this.opt = option;
return this;
} else {
return this.opt;
}
}
}
module.exports = new xpm()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
微信
1
https://gitee.com/lonsonlo/xpmjs.git
git@gitee.com:lonsonlo/xpmjs.git
lonsonlo
xpmjs
xpmjs
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891