Sha256: 468e740f462656cb51d6660d3b32e8b397e9becc12b9f621ae02e00b98b6ba2a

Contents?: true

Size: 1.99 KB

Versions: 2

Compression:

Stored size: 1.99 KB

Contents

/**
 * Boots up the Ext MVC application in the current environment. The environment defaults to 'production',
 * override by setting ?environment=someEnvironment to the end of the url. Default installed environments
 * are 'development' and 'test'
 */
(function() {  
  /**
   * @private
   * Inspects document.location and returns an object containing all of the url params
   * @return {Object} The url params
   */
  var parseLocationParams = function() {
    var args   = window.location.search.split("?")[1],
        //set default params
        params = {
          environment: 'production'
        };
    
    /**
     * Read config data from url parameters
     */
    if (args != undefined) {
      var argPairs = args.split("&");
      
      for (var i=0; i < argPairs.length; i++) {
        var splits = argPairs[i].split("="),
            key    = splits[0],
            value  = splits[1];

        params[key] = value;
      };
    }
    
    return params;
  };
  
  var params      = parseLocationParams(),
      environment = params.environment;
      
  var fileOrders = {
    production : [
      'http://extjs.cachefly.net/ext-3.1.1/adapter/ext/ext-base.js',
      'http://extjs.cachefly.net/ext-3.1.1/ext-all.js',
      '/public/mvc/mvc-all.js',
      '/public/app/app-all.js'
    ],
    development: [
      'http://extjs.cachefly.net/ext-3.1.1/adapter/ext/ext-base.js',
      'http://extjs.cachefly.net/ext-3.1.1/ext-all-debug.js',
      '/public/mvc/mvc-all-debug.js',
      '/public/app/app-all-debug.js'
    ],
    test       : [
      'http://extjs.cachefly.net/ext-3.1.1/adapter/ext/ext-base.js',
      'http://extjs.cachefly.net/ext-3.1.1/ext-all-debug.js',
      '/public/mvc/mvc-all.js',
      '/public/app/app-all.js',
      '../vendor/jspec/lib/jspec.js',
      '../spec/TestHelper.js'
    ]
  };
  
  var filesToLoad = fileOrders[environment];
  for (var i=0; i < filesToLoad.length; i++) {    
    document.write('<script type="text/javascript" src="' + filesToLoad[i] + '"></script>');
  };
})();

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
extjs-mvc-0.4.0.b lib/extjs-mvc/generators/templates/app/config/boot.js
extjs-mvc-0.4.0.a lib/extjs-mvc/generators/templates/app/config/boot.js