title: RequireJS + PhoneGap + Backbone
body: <p>I'm having problem with RequireJS giving me some 'Uncaught TypeError', all i have is the basic structure and when i test it in ripple i often get this.</p>
  
  <pre><code>Uncaught TypeError: Cannot call method 'local_data_exist' of undefined 
  </code></pre>
  
  <p>Which is a function in one of my library.</p>
  
  <pre><code>Uncaught TypeError: Cannot read property 'jqmNavigator' of undefined
  </code></pre>
  
  <p>Or this.</p>
  
  <p>So since the errors are not consistant they give me a hard time to debug. Wonder if anyone has face this before.</p>
  
  <pre><code>require.config({
      deps:['main'],
      baseUrl: "js",
      paths:{
          // Pointing to Main possible fix for random undefined
          app: 'main',
          // jQuery
          jquery:'libs/jquery/jquery-1.9.1.min',
          // jQuery Plugin for Dfp
          dfp: 'libs/jquery/jquery.dfp.min',
          // jQuery Mobile framework
          jqm:'libs/jquery.mobile/jquery.mobile-1.3.0.min',
          // Backbone.js library
          Backbone:'libs/Backbone/Backbone',
          // Backbone.js Adapter
          localStorage: 'libs/Backbone/backbone.localStorage',
          // RequireJS plugin
          text:'libs/require/text',
          // RequireJS plugin
          domReady:'libs/require/domReady',
          // underscore library
          underscore:'libs/underscore/underscore',
          // jQuery Mobile plugin for Backbone views navigation
          jqmNavigator:'libs/jquery.mobile/jqmNavigator',
          //TouchSwipe
          touchSwipe: 'libs/jquery/jquery.touchSwipe.min',
          //Moment (Date Plugin)
          moment: 'libs/moment/moment',
          // Language plugin
          lang: 'libs/moment/langs.min',
          // Utility Lib
          utils: './utils'
      },
      shim:{
          Backbone:{
              deps:['underscore', 'jquery'],
              exports:'Backbone'
          },
          app: {
              deps:['jquery','Backbone','underscore'],
              exports: "App"
          },
          underscore:{
              exports:'_'
          },
          dfp : {
              deps:['jquery']
          },
          jqm:{
              deps:['jquery', 'jqm-config', 'jqmNavigator']
          },
          touchSwipe:{
              deps:['jquery']
          },
          lang:{
              deps:['moment']
          },
          utils:{
              deps:['jquery']
          }
      },
      waitSeconds: 200,
      priority: ['jquery']
  });
  
  require(['jquery', 'domReady', 'Backbone', 'jqm-router', 'models/ApiModel', 'jqm', 'underscore', 'jqm-config', 'jqmNavigator'],
      function ($, domReady, Backbone, AppRouter, Api) {
          domReady(function(){
              window.Api = Api;
              $(this).router = new AppRouter();
          });
      }
  );
  </code></pre>