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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:06:26+00:00 2026-05-22T03:06:26+00:00

I am making Titanium mobile project where I want to make one global function

  • 0

I am making Titanium mobile project where I want to make one global function which I can use throughout the application. For that I have created other .JS file where I have defined the function and I am including that .JS file where I need to use this function and I am successfully able to call the function.

But My question is :

Can I create new Window in that function? As I have added one Label and one MapView in that window but it is not showing, while at the start of function I have added alert('FunctionCalled'), it is showing me alert but not showing me the label I have added in the window.

So anybody can help me to find out whether we can open window through function. If yes then any sample example, so that I can find out what mistake I am making.

Thanks,

Rakesh Gondaliya

  • 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-05-22T03:06:27+00:00Added an answer on May 22, 2026 at 3:06 am

    you approach CAN work but is not a best practice, you should create a global namespace, add the function to that namespace and then only include the file with the function once in app.js

    // apps.js
    var myApp = {};
    Ti.include('global.js','ui.js');
    
    myApp.ui.openMainWindow();
    

    then we create a seperate file for our ui functions

    //ui.js
    (function(){
    
    var ui = {};
    
    ui.openMainWindow = function() {
        // do open window stuff
    
        // call global function
        myApp.global.globalFunction1();
    }
    
    myApp.ui = ui;
    })();
    

    here is where we create our global functions, we will not have to include the file everywhere since we are adding it to our global namespace

    //global.js
    (function(){
    
    var global = {};
    
    global.globalFunction1 = function() {
        // do super global stuff
    }
    
    myApp.global = global;
    })();
    

    this is a simple outline of how it can be implemented, I have a complete code listing on my blog

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

Sidebar

Related Questions

Making an adobe flex ui in which data that is calculated must use proprietary
I am making a mobile application in Appcelerator Titanium. I would like to integrate
im making an application that store multipe information like name description images for each
I have started learning titanium framework.I was making application into iphone.I have made application
Im making a client application for my ZTE Blade Android phone, which receives a
Friends i am making an application in which i am using Map Activity. Now
I'm making a function which will accept either an Unicode string or a bytes
I'm making an app where i want to automatically make an calculation. the numbers
I have been making a little toy web application in C# along the lines
I'm making a WinForms app with a ListView set to detail so that several

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.