The $global scope

jOOPL improves JavaScript development in many ways and it tries to enforce good coding practices and defensive programming by default.

That is why jOOPL introduces the $global keyword, which is a parent object where any entity created by or while using jOOPL must be attached to.

For example, when jOOPL creates a namespace this is attached to the $global object - global scope -:

$namespace.register("MyNamespace"); // accessible via $global.MyNamespace

Actually, either the jOOPL infrastructure and user code may access to the $global object, but it is absolutely discouraged to use $global for declaring global variables or functions: *jOOPL is object-oriented programming and everything in any jOOPL-based JavaScript code should be a namespace, class or interface!

Last edited Feb 25, 2013 at 10:13 AM by MFidemraizer, version 3


No comments yet.