Sencha touch 中的一段源码匿名中定义Function并调用

本文档提供了Sencha Touch 2的使用说明,包括如何加载应用配置文件app.json,并根据其中定义的资源路径引入CSS样式表及JavaScript文件。通过预定义的元标签设置移动端视口和全屏模式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


/*

This file is part of Sencha Touch 2

Copyright (c) 2012 Sencha Inc

Contact: http://www.sencha.com/contact

Commercial Usage
Licensees holding valid commercial licenses may use this file in accordance with the Commercial Software License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Sencha.

If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.

*/
(function() {
function write(content) {
document.write(content);
}

function meta(name, content) {
write('<meta name="' + name + '" content="' + content + '">');
}

var xhr = new XMLHttpRequest();
xhr.open('GET', 'app.json', false);
xhr.send(null);

var options = eval("(" + xhr.responseText + ")"),
scripts = options.js || [],
styleSheets = options.css || [],
i, ln, path;

meta('viewport', 'width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no');
meta('apple-mobile-web-app-capable', 'yes');
meta('apple-touch-fullscreen', 'yes');

for (i = 0,ln = styleSheets.length; i < ln; i++) {
path = styleSheets[i];

if (typeof path != 'string') {
path = path.path;
}

write('<link rel="stylesheet" href="'+path+'">');
}

for (i = 0,ln = scripts.length; i < ln; i++) {
path = scripts[i];

if (typeof path != 'string') {
path = path.path;
}

write('<script src="'+path+'"></'+'script>');
}

})();
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值