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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:37:29+00:00 2026-06-08T04:37:29+00:00

I have two files that I load to the browser. One is loaded directly

  • 0

I have two files that I load to the browser.

One is loaded directly as embedded script in the initial call.

The other is loaded dynamically by creating a script node and writing to the .innerHTML property.

I have to do things this way.

Both snippets of JavaScript are encapsulated in the module pattern.

Can I give them the same name space like this:

Pseudo-code

var ns = Module Pattern 1

var ns = Moudule Pattern 2

If not, is there another way to give them the same name space so that when they return functions I can access the functions uniformly?

ns.function1();
ns.function2();

Because this is for one application I’d prefer to have only one namespace. But as I mentioned I have to load two snippets.

Thanks

  • 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-08T04:37:30+00:00Added an answer on June 8, 2026 at 4:37 am

    With any reasonable mixin implementation, you might try something like:

    var ns = ns || {};
    mixin(ns, Module Pattern 1);
    
    var ns = ns || {};
    mixin(ns, Module Pattern 2);
    

    Then these can be loaded in any order.


    Alternately, change your module pattern a little to accept the namespace object as a parameter and supply the same one to both:

    var ns = ns || {};
    (function(namespace) {
        // ...
        namespace.function1 = //...
    }(ns));   
    
    // (again for module 2)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose i have one folder and inside that another two files are there .
I have two XML files that are generated by another application I have no
I have two text files that contain columnar data of the variety position -
Hi I have two text files that each contain different information about certain structures.The
I have these two simple files that define a C++ class with a tryME
I have two large (~100 GB) text files that must be iterated through simultaneously.
I have two files: master/newsletter1/file.html master/newsletter2/file.html newsletter1/file.html has a lot of new changes that
I have this c# web app that relies heavily on two dll files that
I have a program that compares two files. I ran visual studio analysis and
I wanted to write a program that test if two files are duplicates (have

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.