title: Sencha Touch Global Variables
body: <p>I am working on a Sencha Touch application and I am learning it great because I love JavaScript.</p>
  
  <p>This is my app.js</p>
  
  <pre><code>var App = new Ext.Application({
      name: 'My First App',
  
      //BaseURL: 'http://mydomain.com/testing/first/services/',
  
      launch: function() {
          this.views.viewport = new this.views.Viewport();
  
          // this.BaseURL = "http://mydomain.com/testing/first/services/";
      }
  });
  </code></pre>
  
  <p>This is one of my Store.</p>
  
  <pre><code>var newsStore = new Ext.data.Store({
      model: 'News',
      sorters: [{
          property: 'PostedOn',
          direction: 'DESC'
      }],
      proxy: {
          type: 'ajax',
          url: 'http://mydomain.com/testing/first/services/News.php',
          reader: {
              type: 'xml',
              root: 'News',
              record: 'New'   
          }
      },
      getGroupString: function(record) {
          if (record &amp;&amp; record.data.PostedOn) {
              return record.get('PostedOn').toDateString();
          }
          else {
              return '';
          }
      },
      autoLoad: true
  });
  </code></pre>
  
  <p>Now the question is, if I can create a global variable across whole application? It's named <strong>BaseURL</strong> and I can use it among all Data Stores and when need to change it, I just change this to reflect across whole application.</p>
  
  <p>I need to know two things.</p>
  
  <ol>
  <li>How to declare a global application level variable.</li>
  <li>How to access that variable in views and stores.</li>
  </ol>