使用了sencha架构后,一步一步做了一些优化的尝试,整理出来跟大家分享,当然大家有什么更好的方法欢迎分享,跪求~~ 1. 最开始没有做过build,加载一个页面需要n分钟,n》5.疯了,包括封装在phonegap后也是速度奇慢
2. build 使用sencha app build 命令,开始使用testing命令,方便调试,但是需要加载的app.js文件多达2m多,后来就换成package,app.js迅猛掉500k左右
3. 缓存 1) 使用html5的cache manifest , 不成功 ,老报错,好像需要把所有的js都包含在里面才可以,没有继续尝试 贴上教程大家自己学习,我再试试看成功后再发吧
1. create your cache manifest file in my case my rememberthecard.manifest file looks like this: CACHE MANIFEST #rev5 index.html sencha-touch-beta-0.90/resources/css/ext-touch.css css/memory.css sencha-touch-beta-0.90/ext-touch-debug.js js/memory.all.js images/card-01.jpg images/card-02.jpg images/card-03.jpg images/card-04.jpg images/card-05.jpg images/card-06.jpg images/card-07.jpg images/card-08.jpg images/cover-leaf.jpg tablet_startup.png phone_startup.png see all options you can use in the .manifest file here. 2. Add your manifest to your application .html file header <!doctype html> <html manifest="yourappname.manifest">
3. Add type manifest to your apache config AddType text/cache-manifest .manifest 4. Add .htaccess with expire configuration for your *.manifest file to your app root ExpiresActive On ExpiresDefault "access"2) 使用app.json配置中的appCache /**
其实最想知道如何cache最大的app.js文件,但是sencha example中还没有这样的例子,先提供点思路给大家参考吧,共同研究下 |
|