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

Re: [jslint] Re: Predefined Globals Enhancement

Expand Messages
  • Joshua Bell
    ... in Workers. When writing code that may execute in either Window or Worker context, it s nice to use |self| consistently. Alternately, you can use this
    Message 1 of 4 , Feb 24, 2012
    • 0 Attachment
      On Thu, Feb 23, 2012 at 9:50 AM, douglascrockford <douglas@...>wrote:

      > **
      >
      >
      > --- In jslint_com@yahoogroups.com, "benxwhite" <ben.a.white@...> wrote:
      >
      > > It would be nice if the following predefined globals could be added to
      > the 'browser' array
      > >
      > > self
      >
      > self is redundant.
      >

      |self| is used to refer to the global scope when writing code that will run
      in Workers. When writing code that may execute in either Window or Worker
      context, it's nice to use |self| consistently.

      Alternately, you can use this pattern to wrap your script.

      (function (global) {
      // your code here...
      }(this));

      But the same argument applies to |window| in that case.


      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.