PhoneGap build, hydration & require.js

Newer versions of PhoneGap support lazy loading of javascript, > 2.4 iOs is working as well. To load injected js files (like phonegap.js and plugins) from the build service with requirejs and hydration enabled, you'll have to include the /data/data/XXX/hydra_app/ directory in paths config (replace XXX with your widget id in config.xml) The starting slash will bypass the baseUrl parameter:

requirejs.config({
  baseUrl : "./js",
  paths : {
    'jquery' : 'libs/jquery-1.9.1.min',
    'jqm' : 'libs/jquery.mobile-1.3.1.min',
    'pg' : '/data/data/XXX/hydra_app/phonegap',
    'fb' : '/data/data/XXX/hydra_app/facebook-js-sdk',
    'fbc' : '/data/data/XXX/hydra_app/cdv-plugin-fb-connect',
    'domReady' : 'libs/domReady'
  },
  [...]
});

No comments:

Post a Comment