LabJs 还是 HeadJS?
正在寻找有关这两个 javascript 加载器之间的体验的任何建议吗?
head.js('some-script-here.js');
或
$LAB.script("framework.js").wait();
任何人都可以提供任何这些方面的指导以及其中一个是否比另一个更好?我正在努力寻找任何有比较的文章或者哪个更好用?
Looking for any advice on experiences between these two javascript loaders ?
head.js('some-script-here.js');
Or
$LAB.script("framework.js").wait();
Can anyone provide any guidance on these and whether one is better than another ? I'm struggling to find any articles with comparisons or which is better to use ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我研究了两者以及 YepNope,但没有一个完全符合我的要求。那么我做了什么?我自己写的。
https://github.com/sgarbesi/fallback.js
HeadJS 没有按照我的方式进行回退LabJS 或 YepNope 也不想这么做。
另一方面,RequireJS 做了一些工作,但库太大了。这个库的全部意义在于它尽可能小,这样页面实际上可以尽可能快地加载。
这将允许您加载任意数量的脚本,并拥有任意数量的后备,它还为您提供了一个在所有库加载完成后执行代码的函数。
值得一看,在我看来非常值得我写它。
I looked into both as well as YepNope, none of which did exactly what I wanted. So what did I do? I wrote my own.
https://github.com/sgarbesi/fallback.js
HeadJS didn't do fallbacks how I wanted it to and neither did LabJS or YepNope.
RequireJS on the other hand somewhat did but the library was way too large. The whole point of this library is for it too be as minimal as possible so the page can actually load as fast as possible.
This will allow you to load as many scripts as you want and have as many fallbacks as you want, it also gives you a function to execute your code in after all the libraries have finished loading.
Worth checking it out, in my opinion was well worth me writing it.
什么情况下使用比较好? HeadJS 不仅仅是一个 JavaScript 加载器,它的用途更加广泛。对于某些情况,YepNopeJS 会比其中任何一个更好。
Better to use in what situation? HeadJS is more versatile than just a javascript loader. For some situations, YepNopeJS would be better than either of these.