Nested Namespaces

suggest change

When several classic scripts share a page, avoid proliferating global names by creating a single global namespace. Further objects can be attached under that namespace. Extra nesting adds property lookups and complexity. Longer names can be used if name clashes are an issue:

var NavigationNs = NavigationNs || {};
NavigationNs.active = {};
NavigationNs.pagination = {};
NavigationNs.redirection = {};

// The second level starts here.
NavigationNs.pagination.jquery = function () {};
NavigationNs.pagination.angular = function () {};
NavigationNs.pagination.ember = function () {};

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents