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

The Archive Base Latest Questions

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

information I am trying to build a site where I can include certain files

  • 0

information

I am trying to build a site where I can include certain files and append to my global variable with different methods that will just add easily to the object. Meaning I only need to include the file and this page will now have access to everything in the hutber object.

core hutber.js

var hutber = {};

(function ($) {
    "use strict"; //For good development standards :)

    hutber.init = function(){

    };
    hutber.init();
})(jQuery);

extra bits hutber.form.js

(function ($) {
    "use strict"; //For good development standards :)

    hutber.form = {

    }

});

problem

I am aware that the hutber will not have access to hutber.form as it within a closure. So without taking these out of selfexecuting functions how can I get hutber to have access to hutber.form?
Or is this just the complete wrong way to approach this?

  • 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-17T12:15:00+00:00Added an answer on June 17, 2026 at 12:15 pm

    No it will have access to hutber.form since hutber is global, but the problem is timing.

    If the init() runs before the hutber.form function is executed, it will not be there. The init can not run to all of the “add-ons” are loaded.

    A side note: your second one will not run since it has no (jQuery);.

    (function ($) {
        "use strict"; //For good development standards :)
    
        hutber.form = {
    
        }
    
    });  <-- missing  (jQuery); so it is not going to do anything
    

    Run a little demo to see what happens.

    var myObj = {};
    
    (function(){
    
        myObj.init = function(){
            alert("init");
            try{ //will fail since bar has not loaded yet
            myObj.bar();
            } catch(e){ alert("failed calling bar"); }
        };
        //call init before bar is loaded
        myObj.init();
    })();
    
    
    (function(){
    
        myObj.bar = function(){
            alert("bar");
        };
    })();
    
    //call init after bar has been loaded
    myObj.init();
    

    jsFiddle of above code

    When you run this, you will see that the init will fail the first time it is called since bar is not loaded. The second time it will work since the method is added. So if the init depends on the loaded “modules” it needs to know when they are loaded in order to call the init method.

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

Sidebar

Related Questions

I am trying to build a simple page that will show book information, I
I am trying to build an application that can search the database for different
I am trying to build a Recommendation system that could use the information from
I am trying to achieve dynamic META information so that it will allow META
I'm trying to build an android app that will log into a website, scrape
I'm trying to build a fantasy team site but I can't seem to find
Essentially, I am trying to print out information in JSON so that I can
I'm trying to build a web site for visualization of some statistical information using
I am trying to build a script that posts information into the RoyalMail tracking
I am trying to access information on a website that uses frames. When 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.