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

Global var...

Expand Messages
  • santini.alberto
    Hello. In my javascript files I define, as first line, a namespace like var FOO = YAHOO.namespace( foo ); // alias for YAHOO.foo using Yahoo! User Interface
    Message 1 of 3 , Apr 28, 2008
    • 0 Attachment
      Hello.

      In my javascript files I define, as first line, a namespace like

      var FOO = YAHOO.namespace("foo"); // alias for YAHOO.foo

      using Yahoo! User Interface (YUI) library.

      Of course, JSLint displays "Global var. Use /*global */ instead."
      message. So far, what is it the good practice?

      In YUI code, as example, there is only something like

      YAHOO.namespace("foo");

      so no clue.

      Any idea?

      Thanks in advance,
      Alberto Santini
    • Douglas Crockford
      /*global FOO*/ FOO = YAHOO.namespace( foo );
      Message 2 of 3 , Apr 28, 2008
      • 0 Attachment
        /*global FOO*/
        FOO = YAHOO.namespace("foo");


        --- On Mon, 4/28/08, santini.alberto <albertosantini@...> wrote:

        > From: santini.alberto <albertosantini@...>
        > Subject: [jslint] Global var...
        > To: jslint_com@yahoogroups.com
        > Date: Monday, April 28, 2008, 9:33 AM
        > Hello.
        >
        > In my javascript files I define, as first line, a namespace
        > like
        >
        > var FOO = YAHOO.namespace("foo"); // alias for
        > YAHOO.foo
        >
        > using Yahoo! User Interface (YUI) library.
        >
        > Of course, JSLint displays "Global var. Use /*global
        > */ instead."
        > message. So far, what is it the good practice?
        >
        > In YUI code, as example, there is only something like
        >
        > YAHOO.namespace("foo");
        >
        > so no clue.
        >
        > Any idea?
        >
        > Thanks in advance,
        > Alberto Santini
        >
        >
        > ------------------------------------
        >
        > Yahoo! Groups Links
        >
        >
        >
      • santini.alberto
        ... Ops... so simple! :) I missed that because I deleted var and I get FOO is undefined. . The tricky part is adding /*global FOO */. Thanks again,
        Message 3 of 3 , Apr 29, 2008
        • 0 Attachment
          --- In jslint_com@yahoogroups.com, Douglas Crockford <douglas@...> wrote:
          >
          > /*global FOO*/
          > FOO = YAHOO.namespace("foo");
          >

          Ops... so simple! :)

          I missed that because I deleted 'var' and I get "'FOO' is undefined.".
          The tricky part is adding /*global FOO */.

          Thanks again,
          Alberto
        Your message has been successfully submitted and would be delivered to recipients shortly.