新增Libary
將寫好的function封裝起來。
在preload.js程式中修改。將之建置起來。
$jq(window).load(function(){
var $ = $jq;
var __root = window;
var __conf = {
library: {
name: '$k',
release: {
appName: 'ams',
prefix: 'view',
module: {}, //保存jana 生成的 class
timer: $j.timer,
namespace: $j.namespace,
}
}
};
var __init = function () {
__load();
};
var __load = function () {
var url = '../base/xml/preload.xml?' + Math.floor(Math.random() * 10000000);
$g.load({
url: url,
filter: function (index){
return true;
},
artifact: function (){
},
manifest: function(){
//console.log('manifest: ' + this.url + ', status: ' + this.status);
if (this.status == 'success') {
__buildLibrary(__conf.library);
__loadCore();
}
}
});
};
var __buildLibrary = function ($config) {
__root[$config.name] = $.extend(module.get('core'), $config.release);
//console.log(__root[$config.name]);
}
var __loadCore = function () {
var url = '../base/xml/app.xml?' + Math.floor(Math.random() * 10000000);
$g.load({
url: url,
manifest: function(){
if (this.status == 'success') {
//console.log('manifest: ' + this.url + ', status: ' + this.status);
$g.app.init();
}
}
});
}
__init();
});