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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:45:22+00:00 2026-06-13T04:45:22+00:00

I need to execute some code both on initialize and render methods, but as

  • 0

I need to execute some code both on initialize and render methods, but as I understand, I canot just modfy them directly when using Chaplin – when I define my own initialize method, my routes stop working.

I also tried afterInitialize() but it seems its not meant to be overrided: https://github.com/chaplinjs/chaplin/issues/168#issuecomment-8015915

  • 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-13T04:45:23+00:00Added an answer on June 13, 2026 at 4:45 am

    […] but as I understand, I canot just modfy them directly when using
    Chaplin

    You can modify them directly as long you appropriately delegate to the extended prototype.

    As you haven’t tagged your question javascript or coffeescript, the following are two solutions for each one. First up is javascript. Notice how we must explicitly invoke the extended function.

    var View = Chaplin.View.extend({
      initialize: function(options) {
        // Add code here ..
    
        // The below invokes the initialize function of the
        // base Chaplin.View class in the context of 
        // this class
        Chaplin.View.prototype.initialize.call(this, arguments);
    
        // .. or here
      }
    });
    

    Next is coffeescript, which makes this kind of thing significantly easier.

    class View extends Chaplin.View
      initialize: ->
        // Add code here ..
    
        // The below auto-magically invokes the 
        // initialize method of the base class
        super
    
        // .. or here
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need execute some code before Windows shutdown process each time. So, I want
I need to hook into the WCF operation process to execute some code right
I need to execute some commands in batch mode (e.g., via Rscript). They work
I have a bash script which need to execute some php scripts and to
I need to execute code at intervals, sometimes 10 seconds, sometimes 5 minutes. The
I need to execute my code after finalization of SysUtils unit. I've placed my
I need some help with my code. I have an UIAlert that pops up
I have a Maven project within which I need execute two code generation steps.
I was recently going through some code and considering whether I need to be
I have some regex code originally written in PHP and I need to port

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.