Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use window.addEventListener instead of addEventListener #131

Open
cadorn opened this issue Jan 30, 2015 · 4 comments
Open

Use window.addEventListener instead of addEventListener #131

cadorn opened this issue Jan 30, 2015 · 4 comments

Comments

@cadorn
Copy link

cadorn commented Jan 30, 2015

Having addEventListener dangle as a global is not ideal.

Please use window.addEventListener to provide more context to static analysis tooling.

@calvinmetcalf
Copy link
Owner

do you have a specific issue that it is causing

@cadorn
Copy link
Author

cadorn commented Jan 30, 2015

My static analysis tooling expects all access to global functions via window. I can fix that but it would be a hack on my side.

Having to inject only window as a global when executing this in a different context than browser makes things a lot cleaner than having to inject all the window globals in the to VM container as well.

Also, when looking at the code and you see just addEventListener you don't know what object you are registering events on so you have to see if addEventListener is declared elsewhere in the file before knowing its the window one.

@calvinmetcalf
Copy link
Owner

this the one?

@cadorn
Copy link
Author

cadorn commented Jan 30, 2015

And this one:

addEventListener('message', function (event) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants