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

repl.js redefining global methods #37

Closed
toofar opened this issue Feb 16, 2019 · 1 comment
Closed

repl.js redefining global methods #37

toofar opened this issue Feb 16, 2019 · 1 comment

Comments

@toofar
Copy link

toofar commented Feb 16, 2019

On https://janet-lang.org/ repl.js defines methods in the global scope. In particular print() which ends up overriding window.print(). This probably wont break printing the page in browsers because they wouldn't use the JS API but it might break peoples custom scripts and is not good practice. Everything should be wrapped in an IIFE and anything you need accessable on window from elsewhere should be put there explicitly.

@bakpakin
Copy link
Member

For all website related issues, open the issue in the https://github.com/janet-lang/janet-lang.org repo.

It doesn't really matter in this case. JavaScript "good practice" is for writing packages and large, JavaScript heavy websites. If a custom scripts break with unexpected globals, you need to fix your scripts. It's an easy enough fix though.

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