Closed davidkudera closed 8 years ago
Thanks for the feedback. Would this be better?
Modeled after the nette/forms link.
Also, do you mind pointing to some specific instances of where you see potential issues? Any help would be great.
I think that would be great :+1:
The thing is that with such a code, your library would be completly isolated from the global scope.
Imagine for example tests, you don't need to work with global window, you can simply use some mocked window object only with needed properties or functions.
Or if developer install some other library which also uses the ss
variable, either yours or the other library will not work properly (or at all)...
Simply put, no one can now break your library from outside and also your library can't break any other (only itself :wink:).
Forgot to close this out before. Thanks for your input.
One of the main reasons why people should use commonjs or amd is to be sure, that their object and also objects from foreign libraries does not mess up the global scope and does not use the global object directly.
It's great that this library now supports these techniques, but it violates this "rule" too a little bit.
Some examples of the "right" aproach:
Also there is this nice article: http://ifandelse.com/its-not-hard-making-your-library-support-amd-and-commonjs/