Closed
Description
What problem does this feature solve?
A library should use as less global variables as possible.
One time, I copy & pasted code from one function to another and forgot to change self
back to this
. The code could run but only after a while I was shocked that this self
is actually pointing to window
, not my viewmodel. Global variables, especially one with this common name, might cause confusion and should be renamed.
What does the proposed API look like?
not applicable
Activity
ktsn commentedon Dec 17, 2017
Vue does not have
self
as a global variable butwindow
has in default. https://developer.mozilla.org/en-US/docs/Web/API/Window/selflzl124631x commentedon Dec 17, 2017
Oh thanks @ktsn That's embarrassing. I didn't know that.