Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: Calling javascript which uses setTimeout/setInterval

0
0
That did the trick. I understand the bind method in an abstract sense but without an understanding of how JS handles and changes context its difficult to know when to use it. Your answer prompted me to do a little testing to observe when and how the context changes so I think I understand it better. I assumed that calling a class instance method should have the instance as the current context but in fact it appears to pass the context of the caller by default. I was calling the instance method from the global scope in some cases and from within another object instance in other cases. The bind method fixed those problems.

I know this is technically not really a ClearScript issue - its a lack of understanding JavaScript on my part so I am doubly thankful for your help. My classes are awesome now.

Thanks again!

Viewing all articles
Browse latest Browse all 2297

Latest Images

Trending Articles





Latest Images