In Google Closure Compiler I get the warning
WARNING - dangerous use of the global this object
Here is an example. The error line and offset refers to the beginning of the word this
function aToggle() {
if(shown)
toggle.show()
else
toggle.hide()
$(this).text(shown ? 'Click to hide' : 'Click to show')
shown = !shown
}
link.onclick = aToggle
Now I could mark aToggle
as /**@constructor*/
-- but it is not a constructor. Is there another annotation I can use to eliminate this warning, or am I stuck between marking it as constructor or having a bunch of useless warnings show up?