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

YAHOO.namespace()

Expand Messages
  • Stuart Grimshaw
    I ve been playing with this function to try and introduce some namespacing into our web app, and I m having a little bit of a struggle understanding what s
    Message 1 of 3 , Jan 31, 2007
    • 0 Attachment
      I've been playing with this function to try and introduce some
      namespacing into our web app, and I'm having a little bit of a
      struggle understanding what's going on.

      To effectively create "COMAPNY.PRODUCT.widgets.NavTree" (for example)
      I found I had to do the following:

      COMPANY = {
      PRODUCT: {
      widgets: { }
      }
      }


      and then call

      var COMPANY.PRODUCT.widgets.NavTree =
      YAHOO.namespace("COMPANY.PRODUCT.widgets.NavTree");

      Would a better way be to simply do:

      YAHOO.namespace("COMPANY.PRODUCT.widgets.NavTree");
      var COMPANY = YAHOO.COMPANY;

      ?

      --
      -S

      Sports Photography in South Yorkshire & Derbyshire
      http://www.stuartgrimshaw.co.uk
    • randomjuju
      That should work just fine. -Jon ... wrote: [snip] ... [/snip]
      Message 2 of 3 , Jan 31, 2007
      • 0 Attachment
        That should work just fine.

        -Jon

        --- In ydn-javascript@yahoogroups.com, "Stuart Grimshaw"
        <stuart.grimshaw@...> wrote:
        [snip]
        > Would a better way be to simply do:
        >
        > YAHOO.namespace("COMPANY.PRODUCT.widgets.NavTree");
        > var COMPANY = YAHOO.COMPANY;
        >
        > ?
        [/snip]
      • blueeyes72561
        Message 3 of 3 , Jan 31, 2007
        • 0 Attachment
          --- In ydn-javascript@yahoogroups.com, "randomjuju" <jon.chambers@...>
          wrote:
          >
          > That should work just fine.
          >
          > -Jon
          >
          > --- In ydn-javascript@yahoogroups.com, "Stuart Grimshaw"
          > <stuart.grimshaw@> wrote:
          > [snip]
          > > Would a better way be to simply do:
          > >
          > > YAHOO.namespace("COMPANY.PRODUCT.widgets.NavTree");
          > > var COMPANY = YAHOO.COMPANY;
          > >
          > > ?
          > [/snip]
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.