Does the JavaScript frameworks which mimics namespaces like jQuery makes some namespace collision detection ? If not should I manage it myself ?
If yes what prevents such framework to detect such collision themselves ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
JavaScript namespaces are normally mimicked by using objects and closures, and often initialized with a self-invoking function:
Unfortunately if you redefine the namespace variable, there’s no warning for that. What you could really do is to check if the namespace variable has already been defined, and throw an exception or raise an error if it was: