> I have a couple of plugins that need a couple of global variables

Singleton-y thing...

> and I was thinking about using the Browser object to contain them.

... but that sounds kinda strange.

> Should   we   keep  the  Browser  object  free  in  case  of  future
> compatibility  issues and instead create an object like "Session" or
> would this use be acceptable?

Sounds like you should namespace all your stuff, like Rajeev said. You
ideally  would have a guaranteed-unique namespace (OID-style) to truly
avoid  collisions,  which  ain't  really  gonna  happen... you can get
pretty    close    by    inverting    your    DNS    TLD»SLD»subdomain
(com.example.apps.whatevs), but again everyone else would have to play
along.

If  you  don't fear collisions with other classes, but just don't want
to  add an extra class for shared variables, nor use an existing class
to  hold  them,  nor  use window globals -- I'm thinking you could use
Element  storage  on window or documentElement; you could collide with
other  Moo  users in theory, but you would not collide with anyone who
used  regular  JS  globals.  Just thinking off the top there. I'm sure
someone will locate something wrong with that idea if I don't think of
it first. :)

-- Sandy

Reply via email to