Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8116211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:44:48+00:00 2026-06-06T03:44:48+00:00

Google Closure library provides export symbols option to provide access to constructors through window

  • 0

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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T03:44:50+00:00Added an answer on June 6, 2026 at 3:44 am

    You will almost always have to have at least one thing exposed in the window.

    But, you can use namespaces to help out.

    // app.js
    var App = App || {};
    App.Views = App.Views || {};
    App.Models = App.Models || {};
    
    App.Views.HomeView = Backbone.View.extend({});
    App.Model.User = Backbone.Model.extend({});
    

    The only case in which you won’t necessarily is if you are using requireJS.

    // app.js
    define(['views/home'], function (home) {
        var home = new home({
            el: '#home'
        });
    });
    // views/home.js
    define(['backbone'], function (Backbone) {
        var home = Backbone.View.extend({});
        return home;        
    });
    

    Although, I suppose if you REALLY wanted to, you could do everything inside of a Self Executing Function.

    (function ($, Backbone) {
        // Do your stuff here instead?.
        // Just keep in mind, nothing you do in here will be available outside.
        var home = Backbone.View.extend({});
        new home(); // Works...
    }(jQuery, Backbone);
    new home(); // FAIL!
    

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to teach myself the Google Closure javascript library. I am examining
The Google Closure (GC) Javascript Library makes it very easy to create an AutoComplete
I have a JavaScript file that I ran through the Google Closure compiler, and
I'm testing google closure-compiler and wanting to compile facebox Plugin with the option Advanced
I'm relatively new to the Google Closure library and my current obstacle is getting
As far as I know, Google Closure Template doesn't allow passing Java object into
This solution must use the google closure javascript library and not any other javascript
I had downloaded the Google's closure library from the downloads list here the closure-library-20110323-r790.zip
I pasted the following code in google closure for reducing the size,selected the option
This code is copy from http://code.google.com/p/closure-library/source/browse/trunk/closure/bin/build/source.py The Source class's __str __method referred self._path Is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.