javascript - Referring to non-widget objects in Dojo without "polluting" global namespace -


what's clean best practice keeping track of , referring general javascript objects - dojo-declared - may have been declared in 1 area (read module) of application need used in area? we're assuming amd here.

as mentioned "non-widgets" section of dojo's "using declarative syntax" reference guide:

... regular objects don't have registry dijit based widgets do, therefore in order able reference them after instantiate them, have create reference them in global scope.

global scope? rrraaughh?! 1 of biggest things "modern dojo" frowning upon willy-nilly usage of global namespace:

one of core concepts of "modern" dojo things in global namespace bad. there numerous reasons this, in complex web application, global namespace can become polluted manner of code [...]. means in "modern" dojo, if access in global namespace stop because doing wrong.

also, guide:

again, repeat after me "the global namespace bad, global namespace bad, not use global namespace, not use global namespace".

in light of that, have there been other popular ideas expressed maybe having general-purpose object registry exists in application's context? feasible or perhaps obvious dojo-define module sole purpose mixed bag of references objects used throughout application?


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -