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

Iiab menu js #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Iiab menu js #3

wants to merge 2 commits into from

Conversation

psiie
Copy link

@psiie psiie commented May 27, 2018

refactored to scope as much as possible. Wrapped entire script in an IIFE to scope functions & variables away from the window object. Should improve performance.

By using var calcHtmlLink = function() {} instead of function calcHtmlLink() {}, the function isn't created until it is needed, and can cleanup afterwords. Not only that, it is removed from global scope which when saturated degrades performance.

Wrapped the entire function in a (function() {})() for the same reason.

Also went ahead and made all if/else statements use curly braces. I am all for the shorthand, but for best compatibility, we should wrap them.

added var to some variables. When not declaring var, the js interpreter will elevate/hoist that variable to global scope. It does this as a way to ensure that the program will not crash.

darkenvy added 2 commits May 27, 2018 12:01
…IIFE to scope functions & variables away from the window object. Should improve performance
@georgejhunt georgejhunt mentioned this pull request Dec 4, 2018
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

Successfully merging this pull request may close these issues.

1 participant