Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upMy opinion: Use of self is a bad idea #2
Comments
This comment has been minimized.
This comment has been minimized.
|
Just checked Firefox and self -> Window also... |
This comment has been minimized.
This comment has been minimized.
joshgillies
commented
Jan 27, 2015
|
So advocating the use of |
This comment has been minimized.
This comment has been minimized.
|
I think |
This comment has been minimized.
This comment has been minimized.
|
You are correct that This module catches the case where the user forgets to declare I know no one who would ever intentionally use Error: Code style check failed:
/Users/feross/code/standard/index.js:47:3: 'self' is not defined.I think |
This comment has been minimized.
This comment has been minimized.
|
Fun fact: Did you know that |
This comment has been minimized.
This comment has been minimized.
|
@DamonOehlman Given that there's a check for accidental |
This comment has been minimized.
This comment has been minimized.
|
Yeah absolutely mate - and thanks for the fun fact :) |
DamonOehlman
closed this
Jan 27, 2015
This comment has been minimized.
This comment has been minimized.
tbranyen
commented
Mar 2, 2015
|
Can you use standard when writing WebWorker code where you cannot avoid the self global?
|
This comment has been minimized.
This comment has been minimized.
|
Yep. |
DamonOehlman commentedJan 27, 2015
For a couple of reasons:
selfresolves to the global window context in the same way that this does, well at least that's been my experience and have been confused by it in the past. Open the dev console in chrome and evalselffor an example.Like I said though, this is just my opinion...