I'm sure I've done this before, but I can't seem to repeat my previous solutions...
I have an object created inside a function scope and inside that function I call setTimeout()
I need to access that object inside setTimeout()
Any ideas???
Using local objects inside setTimeout
Moderator: General Moderators
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Oh really? Cool...so if I don't use var it's assumed global or at least outside the scope of the function which invokes setTimeout...cool I did not know that...Kieran Huggins wrote:Any variables used in a function which are not explicitly defined as var are assumed to belong to an outer scope, possibly to the Global (window) Object. Are you using "var object = new Object()" or similar?
If all else fails, attach it to window directly: "window.myObject = new Object()"
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact: