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

  • Home
  • SEARCH
  • 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 7439515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:43:02+00:00 2026-05-29T10:43:02+00:00

I think I’m going about this the wrong way. This is what I’m trying

  • 0

I think I’m going about this the wrong way. This is what I’m trying to do instead of using RequireJS or LABjs:

var APP = {};
APP._timers = {};
APP._timelines = {};

$.when(
    $.getScript('/app/models/Timer.js'),
    $.getScript('/app/models/Section.js'),

    $.getScript('/app/collections/Timers.js'),
    $.getScript('/app/collections/Sections.js'),

    $.getScript('/app/views/SectionView.js'),
    $.getScript('/app/views/APPView.js'),

    $.Deferred(function(deferred){
        $(deferred.resolve);
    })
).done(function () {
    alert('done');
    console.log(APP.APPView);
    var foo = new APP.APPView;
    APP._timelines.main = new APP.Timers('main');
    APP._timelines.branched = new APP.Timers('branched');
}).fail(function(){
    alert('failed');
});

It is alerting failed, nothing is being written to the console.

If I open up any of those files, say APPView.js and alert something at the top or bottom of the file, I see it appear. Here’s an example of that file:

APP.APPView = Backbone.View.extend({
    el : $("#app-view"),
    initialize : function () {
        alert('App view initialized'); // Never gets called
        this.sectionVew = new APP.SectionView();
    }
});
alert('Inside APPView.js'); // gets called
  • 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-05-29T10:43:03+00:00Added an answer on May 29, 2026 at 10:43 am

    I would think the reason why this is failing is because you try to load all your scripts inside $.when without managing dependencies. Each of the $.getScript is async and they do not necessary complete in order. Hence if your view loads before your model execution will stop when it will try to use the undefined model.
    In short, to do this you would have to either:

    1. manage the dependencies manually. i.e. once the model is loaded, THEN load the view.
    2. write trully independent modules
    3. and this is the simplest, stop trying to manually do all that and use an AMD loader such as require.js. This is the reason why it’s there!
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Think about a table like this ID Value 100 1 100 3 101 1
I think that I am misunderstanding something about how jquery $(this) works. In my
think about an array like this: ... key1 => some_call(val1, $params), key2 => some_call(val1,
think about this: StreamReader reader = null; try { reader = new StreamReader(_fileName); }
Think about the following: Your ISP offers you a dynamic ip-address (for example 123.123.123.123).
Think: tiling my emacs window with eshells, a la xmonad. Is this possible? I
I think most people know how to do this via the GUI (right click
I think this is specific to IE 6.0 but... In JavaScript I add a
I think I know how to handle this case, but I just want to
Think about the games like Spiral Knights and Minecraft(Which I believe both use LWJGL)

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.