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 9136935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:01:14+00:00 2026-06-17T09:01:14+00:00

I have been fighting with this problem for hours. I can’t seem to figure

  • 0

I have been fighting with this problem for hours. I can’t seem to figure out why my code had worked and now is not!

I’m building a fairly complex application with Backbone and Marionette on requirejs and I’m new to all of these libraries so it is a little confusing.

I’m getting the error

Uncaught TypeError: Object [object Object] has no method 'apply'

And I can’t seem to figure out what happened or why my app does not work now no matter what code I seem to comment out.

ANY help to point me in the right direction?

  • 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-17T09:01:15+00:00Added an answer on June 17, 2026 at 9:01 am

    I found the problem. I had been going through my code and “optimizing” (so I thought) some of the redundancies.

    Instead of this:

    define(["backbone"], function( Backbone ){
      var model = Backbone.Model.extend({
            myfunc : function(){ /*do stuff */}
      });
    
       return model;
    });
    

    I had changed a bunch of code to look like this:

    define(["backbone"], function( Backbone ){
         return Backbone.Model.extend({
              myfunc : function(){ /*do stuff*/ }
         });
    });
    

    Not a problem right? Mostly.

    I was ALSO using a nifty trick I read about on another post about getting singleton functionality from require.js modules by returning an instantiated model! Cool… mostly.

    I had this:

    define(["backbone"], function( Backbone ){
        var singleton = Backbone.Model.extend({
             myfunc : function(){ /*do singleton stuff*/ }
        });
    
        // because require.js only runs this code once, this essentially creates a singleton!
        return new singleton();
    });
    

    and it worked great!

    Then I got cocky…

    define(["backbone"], function( Backbone ){
        return new Backbone.Model.extend({
             myfunc : function(){ /*do singleton stuff... no more!*/ }
        })();
    });
    

    and I started getting my has no method 'apply' error.

    It took me the better part of 2 days and lots of frustration to track down the problem and I finally got the answer from this post:

    new Backbone.Model() vs Backbone.Model.extend()

    It explains nicely how you can instantiate Backbone.Model but Backbone.Model.extend merely provides you with a constructor that you can THEN use to instantiate a custom Backbone.Model object.

    I hope this saves someone the pain I just went through.

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

Sidebar

Related Questions

i have been fighting with this code for a few hours now.... Sample Node
I have been fighting this for a while, can't figure out why do I
I've been fighting this crazy problem for hours and have gotten nowhere. I have
I have been fighting with this for a couple of days now. I can't
For the last 2 hours I have been fighting with this problem and trying
been fighting with this problem for a good 3 hours now, and i figured
I have been fighting for like 6 hours with this now. I have followed
I have been fighting this problem with the help of a RegEx cheat sheet,
I have been fighting this issue for days now and about to beat my
Good evening, I am tired and have been fighting with this for hours. I

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.