Are said to live in the global namespace. They can conflict with one another at any point. We use a few separate <script> tags for documentation and code separation purposes -- so it's hard to ensure that they do not declare conflicting variables and interfere with one another.
Instead, we now use an anonymous closure whose variables etc are local to that function's scope. For example:
(function() {
var x = 0;
})();
The diff is probably not very readable due to the old code being out-dented by two additional spaces now. But the above should make the intent of this change clear.
Can be merged after Travis is done checking #49 (or I'll re-base and send again if further changes are needed).
Variables declared in JS through a simple:
Are said to live in the global namespace. They can conflict with one another at any point. We use a few separate
<script>
tags for documentation and code separation purposes -- so it's hard to ensure that they do not declare conflicting variables and interfere with one another.Instead, we now use an anonymous closure whose variables etc are local to that function's scope. For example:
The diff is probably not very readable due to the old code being out-dented by two additional spaces now. But the above should make the intent of this change clear.
Can be merged after Travis is done checking #49 (or I'll re-base and send again if further changes are needed).