build/authorify.js
function(func, args, location) {
  var rval = null;

  // default storage types
  if(typeof(location) === 'undefined') {
    location = ['web', 'flash'];
  }

  // apply storage types in order of preference
  var type;
  var done = false;
  var exception = null;
  for(var idx in location) {
    type = location[idx];
    try {
      if(type === 'flash' || type === 'both') {
        if(args[0] === null) {
          throw new Error('Flash local storage not available.');
        } else {
          rval = func.apply(this, args);
          done = (type === 'flash');
        }
      }
      if(type === 'web' || type === 'both') {
        args[0] = localStorage;
        rval = func.apply(this, args);
        done = true;
      }
    } catch(ex) {
      exception = ex;
    }
    if(done) {
      break;
    }
  }

  if(!done) {
    throw exception;
  }

  return rval;
}
function(func, args, location) {
  var rval = null;

  // default storage types
  if(typeof(location) === 'undefined') {
    location = ['web', 'flash'];
  }

  // apply storage types in order of preference
  var type;
  var done = false;
  var exception = null;
  for(var idx in location) {
    type = location[idx];
    try {
      if(type === 'flash' || type === 'both') {
        if(args[0] === null) {
          throw new Error('Flash local storage not available.');
        } else {
          rval = func.apply(this, args);
          done = (type === 'flash');
        }
      }
      if(type === 'web' || type === 'both') {
        args[0] = localStorage;
        rval = func.apply(this, args);
        done = true;
      }
    } catch(ex) {
      exception = ex;
    }
    if(done) {
      break;
    }
  }

  if(!done) {
    throw exception;
  }

  return rval;
}
function ( func , args , location ) { var rval = null ; // default storage types if ( typeof ( location ) === 'undefined' ) { location = [ 'web' , 'flash' ] ; } // apply storage types in order of preference var type ; var done = false ; var exception = null ; for ( var idx in location ) { type = location [ idx ] ; try { if ( type === 'flash' || type === 'both' ) { if ( args [ 0 ] === null ) { throw new Error ( 'Flash local storage not available.' ) ; } else { rval = func . apply ( this , args ) ; done = ( type === 'flash' ) ; } } if ( type === 'web' || type === 'both' ) { args [ 0 ] = localStorage ; rval = func . apply ( this , args ) ; done = true ; } } catch ( ex ) { exception = ex ; } if ( done ) { break ; } } if ( ! done ) { throw exception ; } return rval ; }
Calls a storage function.

@param func the function to call.
@param args the arguments for the function.
@param location the location argument.

@return the return value from the function.
Calls a storage function .