延迟加载和依赖项解析

编程入门 行业动态 更新时间:2024-10-28 01:22:22
本文介绍了延迟加载和依赖项解析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

前一段时间,我正在读一篇关于他的图书馆如何做的文章(一个人建造的图书馆)

some time ago, I was reading an article(a library built by some guy) about how his library can do

  • 延迟加载JS
  • 解决JS 之间的依赖关系(通常在尝试将包含来自另一个js时遇到)
  • 仅包含文件一次。认为多次指定,无论如何调用它们(直接指定为文件或指定它作为依赖项之一)
  • 我忘了给它添加书签,这是多么的错误。有人可以指出我能做到的事情。我知道DOJO和YUI库有这样的东西,但我正在寻找一些可以用于jQuery的东西

    I forgot to bookmark it, what a mistake. Can some one point me to something which can do the above. I know DOJO and YUI library have something like this, but I am looking for something which I can use with jQuery

    我可能还在寻找另外一个功能。

    I am probably looking for one more feature as well.

    • 我的网站有asp用户控件(可重复使用的服务器端代码片段)有一些JS。他们中的一些人立即获得,当页面为 loading时,会给用户带来不良的体验。 Yahoo性能指南指定JS应该是在页面的底部,但这在我的情况下是不可能的这将要求我将 JS和相应的服务器端控件分成不同的文件和维护将很困难。我绝对可以在我的用户控件 JS中放置一个jQuery document.ready()以确保它在DOM加载后仅触发,但我是寻找更简单的解决方案。
    • My site has asp user controls (reusable server side code snippets) which have some JS. Some of them get fired right away, when the page is loading which gives a bad user experience. Yahoo performance guidelines specify that JS should be at the bottom of the page, but this is not possible in my case as this would require me to separate the JS and the corresponding server side control into different files and maintenance would be difficult. I definitely can put a jQuery document.ready() in my user control JS to make sure that it fires only after the DOM has loaded, but I am looking for a simpler solution.

    无论如何我可以说开始执行任何 JS只有在DOM以全局方式加载document.ready之后才能加载每个用户控件?

    Is there anyway that I could say "begin executing any JS only after DOM has loaded" in a global way than just writing "document.ready" within every user control ?

    推荐答案

    好的我我发现链接

    ajaxian/archives/usingjs-manage-javascript-dependencies www.jondavis/techblog/post/2008/04/Javascript-Introducing-Using-%28js%29.aspx

    我还找到了一个,对于对延迟加载/动态js depe感兴趣的人ndency resolution

    I also found one more, for folks who are interested in lazy loading/dynamic js dependency resolution

    jsload/

    更多推荐

    延迟加载和依赖项解析

    本文发布于:2023-11-13 11:50:17,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1584284.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:加载

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!