Google Closure library provides export symbols option to provide access to constructors through window object.
ex: export task will allows doing window.task
BUT this is totally far from Google closure library. I am using Backbone.js to construct a task application. My views,models, routers and split up in many files and i follow the above process to assign the instance, source to window object so that one can access another.
- How can i access models, views, routers for a single application not through window? What tricks, tips have you employed to make them kind of sandboxed
You will almost always have to have at least one thing exposed in the window.
But, you can use namespaces to help out.
The only case in which you won’t necessarily is if you are using requireJS.
Although, I suppose if you REALLY wanted to, you could do everything inside of a Self Executing Function.
The only problem with that is anything you do inside of the function is not available outside of it.
Let me know if you have any questions on any implementations.