-
Notifications
You must be signed in to change notification settings - Fork 149
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
Avoid unnecessary global variables #15
Comments
I have this thing written on a note, you read my mind completely :). I thought about the anonymous wrapper but my last impression was that it should simply be A cool test would be somehow to check the global entities before loading the dragdealer lib, and then after, expecting only one increment in the number of keys on Feel free to push for the best option you feel Dragdealer should adopt |
What are your thoughts about adding optional support for AMD? I'm a big fan of requirejs, so I suggest this wrapping:
|
Sure, I use requirejs a lot. Wasn't aware of this wrapping but looks pretty cool to me. Don't know if there's a need for the Awesome stuff! |
It will also allow better minification (when local variables get shorter names). |
I get that, I was thinking that we drop the Dragdealer.Cursor altogether and leave it like it is now. You think there would be some value in making them public through the Dragdealer namespace? I guess, maybe for debugging, cause I don't think other libs should rely on them through cross-dependencies :) |
Dragdealer creates 3 global variables (Dragdealer, Cursor, Position). While it would be better to expose only one global that is accessed from the outside of the module.
This can be easily fixed by wrapping module contents in self-executing anonymous function. Another option to consider is to use UMD pattern.
The text was updated successfully, but these errors were encountered: