Re: Event binding/this problem
David Gee <[email protected]>
| Newsgroups | gmane.comp.web.dom.wdf |
|---|---|
| Message-ID | <[email protected]> |
Scott Sauyet wrote: > One rather ugly way to do this is with a global variable. I'm sure > there's something better, but this is the first thing that comes to mind > (and me calling myself an OO programmer... shame!) > There's something I occassionally do, when I'm really stumped and need to create a global var for an object. I've often wondered about it's practically/usefulness: Let's say I'm working with an object called MyObject. When initializing the object, I'll set window.MyObject as a placeholder for any "global" vars I may need to create. So let's say I run into a problem where MyObject needs to create a global var called myProp. I'll just create it as window.MyObject.myProp. The way I see it, this solves the major problem with using global vars - colliding with other scripts, overwriting other global vars. For me, that's always been the main reason to avoid using global vars. Are their other considerations (i'm thinking memory leaks) that I should be taking into consideration? david -- david gee ::: [email protected] ::: http://www.mode3.com/david ------------------------ Yahoo! Groups Sponsor --------------------~--> Get fast access to your favorite Yahoo! Groups. Make Yahoo! your home page http://us.click.yahoo.com/dpRU5A/wUILAA/yQLSAA/9rHolB/TM --------------------------------------------------------------------~-> Unsubscribe [email protected] List info http://www.quirksmode.org/dom/list.html Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/wdf-dom/ <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/