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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:26:58+00:00 2026-06-11T09:26:58+00:00

I’m currently rewriting an old app with Backbone and Marionette. In my module file

  • 0

I’m currently rewriting an old app with Backbone and Marionette.
In my module file spls.module.insight.js:

spls.module('Insight', {
    startWithApp: false,
    define: function(self, spls, Backbone, Marionette, $, _) {

        self.start = function () {
            console.log('Insight started!');
        }

        self.addInitializer(function() {
           console.log('Insight instantiated!');
        });
    }
});

I am trying to hook in to the start() method because I thought this would be the normal method to use when waiting for the start() of a module. (it does get initialized only once, so I cant use the initializer. But what else?)
On the second call to spls.module(‘Insight’).start(); i recieve two “Insight started!” messages.
Why is this?

Is there a better way to solve this?


More info on what I want to achieve:
I just started using Marionette and thus don’t have deep understanding of what the modules do and in which way they interact yet.
What I wanted to achieve was basically a main App (works) which opens pages (the modules) via the router.
Currently I am calling

Spls.module('Insight').start();

From the router, but I don’t know how to design the module itself.
The initializer seems to only get called on the first .start() thus the module doesn’t know when to show it’s content.
Should I use the event aggregator like so?

// router
Spls.module('Insight').start();
Spls.vent.trigger('insight:show');

// module
Spls.vent.on('insight:show', function () {  /* show index */ });

I basically need more information on how to work with modules, I could’t find any good information about the appropriate workflow regarding this.

Thanks again!

  • 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-11T09:26:59+00:00Added an answer on June 11, 2026 at 9:26 am

    Don’t override the start method. Bad things will happen, as you’ve already seen, including your initializers won’t get run and other behind the scenes code won’t get executed.

    If you need code to run when the module is started, use an initializer. If you need code to run when the module is stopped, use a finalizer. The start method and stop method take care of running the initializers, finalizers, and a handful of other necessary things behind the scenes.

    As for that message showing up twice – In my quick test, I’m not seeing this message twice. I’m only seeing it once. Is there another bit of code that is defining a second module of the same name (a split module definition) or something else along those lines?


    Update for your additional questions:

    Calling start multiple times will only re-run the initializers if you have also called stop on the module.

    
    Spls.module("Insight").start();
    
    // some time later...
    Spls.module("Insight").stop();
    
    // now it can be re-started and the initializers will run again
    Spls.module("Insight").start();
    

    You can keep track of which module is currently running. Then when a new route fires, you can stop the current one before starting the next one. That should be enough to things working right:

    
    insightRoute: function(){
      if (this.module){
        this.module.stop();
      }
      this.module = Spls.module("Insight");
      this.module.start();
    }
    

    This could easily be extracted in to a method in your router or the object that your router calls if you’re using Marionette’s AppRouter.

    Hope that helps.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
In my XML file chapters tag has more chapter tag.i need to display chapters
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains

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.