Loading ...
Sorry, an error occurred while loading the content.

Re: [ydn-javascript] multiple loader objects

Expand Messages
  • Eric Miraglia
    Jan, Yes --- relying on YUI Loader for all lazy-loaded widget instances is a good thing. YUI Loader is designed to know about all YUI usage in the current
    Message 1 of 4 , Jun 2, 2008
    • 0 Attachment
      Jan,

      Yes --- relying on YUI Loader for all lazy-loaded widget instances is a good thing.  YUI Loader is designed to know about all YUI usage in the current window and to optimize subsequent downloads to include only JS files that (a) are needed and (b) are not yet present.

      As for the multiply-loading CSS files, I'm less worried here about bandwidth -- probably any subsequent request for the same CSS would result in a cache hit rather than a full data retrieval from the server.  The downside of that behavior would be that the creation, population, and processing of the extra link node is not "free" in CPU terms.

      Regards,
      Eric


      On Jun 2, 2008, at 10:54 AM, Jan Rychter wrote:

      Eric Miraglia <miraglia@yahoo- inc.com> writes:

      > Jan,
      >
      > At present, the YUI Loader across instances will only load modules that
      > have not been loaded yet. (This is true for JavaScript files but not
      > for CSS files; YUI Loader instance knows only about the CSS files that
      > it loaded itself.)
      >
      > Here's the definitive word from the component's author:
      >
      > http://tech. groups.yahoo. com/group/ ydn-javascript/ message/31092

      Hmm. So I can expect wasted bandwidth because of multiply-loaded CSS
      files. But should I expect any other breakage?

      I could probably make do with a single instance, but will I be
      guaranteed that all my onSuccess callback functions will get called, or
      would I need to worry about that myself?

      Think of it this way: YUILoader is my main entry point for creating
      widgets. I _always_ create and initialize them from a loader callback,
      so that I can be sure that all their dependencies have been loaded. Is
      this something that will work?

      --J.

      > On Jun 2, 2008, at 6:10 AM, Jan Rychter wrote:
      >
      >> Just checking: I use the YUILoader for lazy-loading of YUI libraries,
      >> with actual widget configuration code placed in callback functions.
      >>
      >> Should I expect any problems if there are multiple loader objects
      >> created and running simultaneously? Will they work correctly,
      >> e.g. will
      >> they only load what hasn't been loaded yet?
      >>
      >> I would expect them to work correctly, but I thought I'd check. If the
      >> above isn't true, I'll need to create and manage a callback queue,
      >> which
      >> would be a pain.
      >>
      >> thanks,
      >> --J.
      >>
      >>


    Your message has been successfully submitted and would be delivered to recipients shortly.