stackmob-js-0.9.2.js
function(options) {

      options = options || {};

      // Run stuff before StackMob is initialized.
      this.initStart(options);

      /* DEPRECATED METHODS BELOW */
      this.userSchema = options['userSchema'];        // DEPRECATED: Use StackMob.User.extend({ schemaName: 'customschemaname' });
      this.loginField = options['loginField'];        // DEPRECATED: Use StackMob.User.extend({ loginField: 'customloginfield' });
      this.passwordField = options['passwordField'];  // DEPRECATED: Use StackMob.User.extend({ passwordField: 'custompasswordfield' });
      /* DEPRECATED METHODS ABOVE */

      this.newPasswordField = 'new_password';

      this.publicKey = options['publicKey'];

      this.apiVersion = options['apiVersion'] || this.DEFAULT_API_VERSION;

      /*
       * apiURL (DEPRECATED) - Advaanced Users Only.  Use apiDomain instead.
       * Used to redirect SDK requests to a different URL.
       *
       */
      if (typeof options['apiURL'] !== "undefined")
        throw new Error("Error: apiURL is no longer supported.  The API URL is now automatically set for PhoneGap users.");

      /*
       * apiDomain - Advanced Users Only. Only set apiDomain to redirect SDK
       * requests to a different domain.
       *
       * Init variable 'apiDomain' should not contain a URL scheme (http:// or https://).
       * Scheme will be prepended according to 'secure' init setting.
       */
      var apiDomain = options['apiDomain'];
      if (typeof apiDomain === "string"){
        if (apiDomain.indexOf('http') === 0){
          throw new Error("Error: apiDomain should not specify url scheme (http/https). For example, specify api.stackmob.com instead of http://api.stackmob.com. URL Scheme is determined by the 'secure' init variable.");
        } else {
          if (apiDomain.indexOf('/') == apiDomain.length - 1){
            this.apiDomain = apiDomain;
          } else {
            this.apiDomain = apiDomain + '/';
          }
        }
      }

      /*
       * useRelativePathForAjax - Advanced Users Only. Use to redirect SDK requests to a
       * path relative to the current URL.  Will only work for StackMob Hosts that can
       * properly proxy requests to api.stackmob.com
       *
       * HTML5 apps hosted on stackmobapp.com will be set to `true` and use a relative path
       * automatically.
       */
      var isSMHosted = (this.getHostname().indexOf('.stackmobapp.com') > 0);
      this.useRelativePathForAjax = (typeof options['useRelativePathForAjax'] === "boolean") ? options['useRelativePathForAjax'] : isSMHosted;

      /*
       * secure - Determine which requests should be done over SSL.
       * Default the security mode to match the current URL scheme.
       *
       * If current page is HTTPS, set to SECURE_ALWAYS.
       * If current page is HTTP, set to SECURE_NEVER.
       * Otherwise, set to SECURE_MIXED.
       * Can be overridden by manually specifying a security mode in init().
       */
      if (options['secure']) {
        this.secure = options['secure'];
      } else if (this.getProtocol().indexOf("https:") == 0) {
        this.secure = this.SECURE_ALWAYS;
      } else if (this.getProtocol().indexOf("http:") == 0) {
        this.secure = this.SECURE_NEVER;
      } else {
        this.secure = this.SECURE_MIXED;
      }

      this.ajax = options['ajax'] || this.ajax;

      this.initEnd(options);

      return this;
    }
function(options) {

      options = options || {};

      // Run stuff before StackMob is initialized.
      this.initStart(options);

      /* DEPRECATED METHODS BELOW */
      this.userSchema = options['userSchema'];        // DEPRECATED: Use StackMob.User.extend({ schemaName: 'customschemaname' });
      this.loginField = options['loginField'];        // DEPRECATED: Use StackMob.User.extend({ loginField: 'customloginfield' });
      this.passwordField = options['passwordField'];  // DEPRECATED: Use StackMob.User.extend({ passwordField: 'custompasswordfield' });
      /* DEPRECATED METHODS ABOVE */

      this.newPasswordField = 'new_password';

      this.publicKey = options['publicKey'];

      this.apiVersion = options['apiVersion'] || this.DEFAULT_API_VERSION;

      /*
       * apiURL (DEPRECATED) - Advaanced Users Only.  Use apiDomain instead.
       * Used to redirect SDK requests to a different URL.
       *
       */
      if (typeof options['apiURL'] !== "undefined")
        throw new Error("Error: apiURL is no longer supported.  The API URL is now automatically set for PhoneGap users.");

      /*
       * apiDomain - Advanced Users Only. Only set apiDomain to redirect SDK
       * requests to a different domain.
       *
       * Init variable 'apiDomain' should not contain a URL scheme (http:// or https://).
       * Scheme will be prepended according to 'secure' init setting.
       */
      var apiDomain = options['apiDomain'];
      if (typeof apiDomain === "string"){
        if (apiDomain.indexOf('http') === 0){
          throw new Error("Error: apiDomain should not specify url scheme (http/https). For example, specify api.stackmob.com instead of http://api.stackmob.com. URL Scheme is determined by the 'secure' init variable.");
        } else {
          if (apiDomain.indexOf('/') == apiDomain.length - 1){
            this.apiDomain = apiDomain;
          } else {
            this.apiDomain = apiDomain + '/';
          }
        }
      }

      /*
       * useRelativePathForAjax - Advanced Users Only. Use to redirect SDK requests to a
       * path relative to the current URL.  Will only work for StackMob Hosts that can
       * properly proxy requests to api.stackmob.com
       *
       * HTML5 apps hosted on stackmobapp.com will be set to `true` and use a relative path
       * automatically.
       */
      var isSMHosted = (this.getHostname().indexOf('.stackmobapp.com') > 0);
      this.useRelativePathForAjax = (typeof options['useRelativePathForAjax'] === "boolean") ? options['useRelativePathForAjax'] : isSMHosted;

      /*
       * secure - Determine which requests should be done over SSL.
       * Default the security mode to match the current URL scheme.
       *
       * If current page is HTTPS, set to SECURE_ALWAYS.
       * If current page is HTTP, set to SECURE_NEVER.
       * Otherwise, set to SECURE_MIXED.
       * Can be overridden by manually specifying a security mode in init().
       */
      if (options['secure']) {
        this.secure = options['secure'];
      } else if (this.getProtocol().indexOf("https:") == 0) {
        this.secure = this.SECURE_ALWAYS;
      } else if (this.getProtocol().indexOf("http:") == 0) {
        this.secure = this.SECURE_NEVER;
      } else {
        this.secure = this.SECURE_MIXED;
      }

      this.ajax = options['ajax'] || this.ajax;

      this.initEnd(options);

      return this;
    }
function ( options ) { options = options || { } ; // Run stuff before StackMob is initialized. this . initStart ( options ) ; /* DEPRECATED METHODS BELOW */ this . userSchema = options [ 'userSchema' ] ; // DEPRECATED: Use StackMob.User.extend({ schemaName: 'customschemaname' }); this . loginField = options [ 'loginField' ] ; // DEPRECATED: Use StackMob.User.extend({ loginField: 'customloginfield' }); this . passwordField = options [ 'passwordField' ] ; // DEPRECATED: Use StackMob.User.extend({ passwordField: 'custompasswordfield' }); /* DEPRECATED METHODS ABOVE */ this . newPasswordField = 'new_password' ; this . publicKey = options [ 'publicKey' ] ; this . apiVersion = options [ 'apiVersion' ] || this . DEFAULT_API_VERSION ; /*
       * apiURL (DEPRECATED) - Advaanced Users Only.  Use apiDomain instead.
       * Used to redirect SDK requests to a different URL.
       *
       */ if ( typeof options [ 'apiURL' ] !== "undefined" ) throw new Error ( "Error: apiURL is no longer supported.  The API URL is now automatically set for PhoneGap users." ) ; /*
       * apiDomain - Advanced Users Only. Only set apiDomain to redirect SDK
       * requests to a different domain.
       *
       * Init variable 'apiDomain' should not contain a URL scheme (http:// or https://).
       * Scheme will be prepended according to 'secure' init setting.
       */ var apiDomain = options [ 'apiDomain' ] ; if ( typeof apiDomain === "string" ) { if ( apiDomain . indexOf ( 'http' ) === 0 ) { throw new Error ( "Error: apiDomain should not specify url scheme (http/https). For example, specify api.stackmob.com instead of http://api.stackmob.com. URL Scheme is determined by the 'secure' init variable." ) ; } else { if ( apiDomain . indexOf ( '/' ) == apiDomain . length - 1 ) { this . apiDomain = apiDomain ; } else { this . apiDomain = apiDomain + '/' ; } } } /*
       * useRelativePathForAjax - Advanced Users Only. Use to redirect SDK requests to a
       * path relative to the current URL.  Will only work for StackMob Hosts that can
       * properly proxy requests to api.stackmob.com
       *
       * HTML5 apps hosted on stackmobapp.com will be set to `true` and use a relative path
       * automatically.
       */ var isSMHosted = ( this . getHostname ( ) . indexOf ( '.stackmobapp.com' ) > 0 ) ; this . useRelativePathForAjax = ( typeof options [ 'useRelativePathForAjax' ] === "boolean" ) ? options [ 'useRelativePathForAjax' ] : isSMHosted ; /*
       * secure - Determine which requests should be done over SSL.
       * Default the security mode to match the current URL scheme.
       *
       * If current page is HTTPS, set to SECURE_ALWAYS.
       * If current page is HTTP, set to SECURE_NEVER.
       * Otherwise, set to SECURE_MIXED.
       * Can be overridden by manually specifying a security mode in init().
       */ if ( options [ 'secure' ] ) { this . secure = options [ 'secure' ] ; } else if ( this . getProtocol ( ) . indexOf ( "https:" ) == 0 ) { this . secure = this . SECURE_ALWAYS ; } else if ( this . getProtocol ( ) . indexOf ( "http:" ) == 0 ) { this . secure = this . SECURE_NEVER ; } else { this . secure = this . SECURE_MIXED ; } this . ajax = options [ 'ajax' ] || this . ajax ; this . initEnd ( options ) ; return this ; }
Externally called by user to initialize their StackMob config.
Externally called by user to initialize their StackMob config .