LabJs 还是 HeadJS?

发布于 2024-11-17 01:19:50 字数 228 浏览 3 评论 0原文

正在寻找有关这两个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情未る 2024-11-24 01:19:50

我研究了两者以及 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.

走野 2024-11-24 01:19:50

什么情况下使用比较好? 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文