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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:40:17+00:00 2026-06-04T10:40:17+00:00

I have a top level application called SearchApp which has a sub-app called TeamApp

  • 0

I have a top level application called SearchApp which has a sub-app called TeamApp. The files are structured like this:

search_app.js.coffee # The top-level application.
team_app/
  app.js.coffee
  team_list.js.coffee
  team_invite.js.coffee

I initialize my application in search_app.js.coffee:

window.Domainer = {}

# This is the top level application.
Domainer.SearchApp = new Backbone.Marionette.Application()

# Assign a region to the Application.
Domainer.SearchApp.addRegions(stage: '#stage')

And start it in the html view:

<script>Domainer.SearchApp.start({});</script>

The Submodule TeamApp is laid out over a few files (below). THe problem is that some of the files in the TeamApp module don’t seem to be able to add initializers to the SearchApp. This is evidenced by the fact that I can console.log from the initialization in one file but not in the other.

# team_app/app.js.coffee
Domainer.SearchApp.module "TeamApp", (TeamApp, SearchApp, Backbone, Marionette, $, _) ->

  # Initializers
  # ----------

  SearchApp.addInitializer (options) ->
    console.log "This will log when I call Domainer.SearchApp.start()"

  # In coffeescript it's important to explicitly return.
  return TeamApp

# team_app/team_list.js.coffee
Domainer.SearchApp.module "TeamApp", (TeamApp, SearchApp, Backbone, Marionette, $, _) ->

  class CompactSearcher extends Marionette.ItemView
    # ... various code relating to this view.

  class TeamList extends Marionette.CollectionView
    # various code relating to this view.

  SearchApp.addInitializer (options) ->
    console.log "This will never log for some reason."

  return TeamApp

# team_app/invite_view.js.coffee
Domainer.SearchApp.module "TeamApp", (TeamApp, SearchApp, Backbone, Marionette, $, _) ->

  class InviteView extends Marionette.ItemView
    # ... various code relating to this view.

  SearchApp.addInitializer (options) ->
    console.log "This will never log either."

  return TeamApp

Is it not possible to split one module across multiple files? That’s the only thing that I can think is happening here. What else could be causing the problem?

  • 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-04T10:40:18+00:00Added an answer on June 4, 2026 at 10:40 am

    You ask:

    Is it not possible to split one module across multiple files?

    Checking the backbone-marionette source confirms that this is exactly what’s going on:

    // Get the module name, and check if it exists on
    // the current parent already
    moduleName = moduleNames[i];
    module = parentModule[moduleName];
    
    if (!module){ 
      // This is where the module definition is used...
    }
    
    return module;
    

    So if you try to define the same module multiple times, only the first definition will be used.

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

Sidebar

Related Questions

My application has several independent top-level windows, which all have completely different functions/workflows. I
I have an application with a UITabBarController at its top level. I track which
I have a component with multiple top level folders which correspond to jar files.
In my application I have a top level entity called Organization. The relationship between
I have 10 top-level domains e.g. example1.com, example2.com, example3.com, etc, and each domain has
I have a silverlight class library (not a top-level application) with several user controls
We have an application, n-tier like structured, but I wouldn't say it's n-tiered. The
My application has a frame that is loaded/navigated when certain top-level buttons are clicked.
In my application I have a Form that for one of the top level
I created a top level directory called 'maintenance' in my Ruby on Rails application.

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.