-
Notifications
You must be signed in to change notification settings - Fork 0
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
Scope, IIFEs etc #24
Comments
Thanks for this Eoin! |
ghost
pushed a commit
that referenced
this issue
Jun 28, 2017
before, we were declaring global variables. I have changed this now so that any variables that we need across functions are declared in an iife and saved to the one GV echo. relates #24
ghost
mentioned this issue
Jun 28, 2017
Closed
des-des
added a commit
that referenced
this issue
Jul 3, 2017
related #24 Conflicts: public/scripts/d3/d3.js public/scripts/d3/setup.js public/scripts/helpers/helpers.js
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Okay, this came up in a pull so I thought I would drop my thought in an issue.
The top level scope in a js file is global in the browser, You should not be writing code here as you will accidentally declare variables in global scope (very bad).
I see 2 ways of sharing stuiff between files
1: Declare only one global variable. call it
echo
.The
You can also use
$document.ready(() => {})
or something from jquery2:
Write your code as if in node (
module.exports
,require
), then use browserifyThe text was updated successfully, but these errors were encountered: