Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
cwmma
on Dec 30, 2012
|
parent
|
context
|
favorite
| on:
JavaScript: Clarifying The Keyword ‘this’
Another exception, functions invoked with setInterval have 'this' be window, even if they're invoked in context with it's own 'this'. This got me the other day.
https://developer.mozilla.org/en-US/docs/DOM/window.setInter...
jQueryIsAwesome
on Dec 30, 2012
[–]
A workaround that I like a little more:
http://javascriptisawesome.blogspot.com/2011/11/setinterval-...
cwmma
on Dec 30, 2012
|
parent
[–]
There are totally a bunch of workarounds, it's just another exception to this, I was using CoffeeScript so I was able to grossly simplify the MDN one
https://github.com/calvinmetcalf/communist/blob/master/src/s...
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: