Packagecom.myflashlab.air.extensions.sharedPreferences
Classpublic class SharedPreferences
InheritanceSharedPreferences Inheritance Object

Wraps NSUserDefaults (on iOS) and SharedPreferences (on Android), providing a persistent store for simple data. Data is persisted to disk asynchronously.



Public Methods
 MethodDefined By
  
clear():void
[static] Clears user preferences for the app
SharedPreferences
  
getAll():Object
[static]
SharedPreferences
  
getBool($key:String):Boolean
[static] Reads a value from persistent storage, throwing an exception if it's not a Boolean.
SharedPreferences
  
getInt($key:String):int
[static] Reads a value from persistent storage, throwing an exception if it's not a int.
SharedPreferences
  
getKeys():Array
[static] Returns all keys in the persistent storage.
SharedPreferences
  
getNumber($key:String):Number
[static] Reads a value from persistent storage, throwing an exception if it's not a Number.
SharedPreferences
  
getString($key:String):String
[static] Reads a value from persistent storage, throwing an exception if it's not a String.
SharedPreferences
  
getStringArray($key:String):Array
[static] Reads a value from persistent storage, throwing an exception if it's not a Array.
SharedPreferences
  
getValue($key:String):*
[static] Reads a value of any type from persistent storage.
SharedPreferences
  
init():void
[static]
SharedPreferences
  
[static] grabs a refreshed copy of saved preferences from the native side and replaces with the cached object on the AIR side.
SharedPreferences
  
remove($key:String):void
[static] Removes an entry from persistent storage.
SharedPreferences
  
setBool($key:String, $value:Boolean):void
[static] Saves a boolean [value] to persistent storage in the background.
SharedPreferences
  
setInt($key:String, $value:int):void
[static] Saves an integer [value] to persistent storage in the background.
SharedPreferences
  
setNumber($key:String, $value:Number):void
[static] Saves a Number [value] to persistent storage in the background.
SharedPreferences
  
setString($key:String, $value:String):void
[static] Saves a string [value] to persistent storage in the background.
SharedPreferences
  
setStringArray($key:String, $value:Array):void
[static] Saves an array of strings [value] to persistent storage in the background.
SharedPreferences
Public Constants
 ConstantDefined By
  EXTENSION_ID : String = com.myflashlab.air.extensions.sharedPreferences
[static]
SharedPreferences
  VERSION : String = 0.0.11
[static]
SharedPreferences
Method Detail
clear()method
public static function clear():void

Clears user preferences for the app

getAll()method 
public static function getAll():Object

Returns
Object
getBool()method 
public static function getBool($key:String):Boolean

Reads a value from persistent storage, throwing an exception if it's not a Boolean.

Parameters

$key:String

Returns
Boolean
getInt()method 
public static function getInt($key:String):int

Reads a value from persistent storage, throwing an exception if it's not a int.

Parameters

$key:String

Returns
int
getKeys()method 
public static function getKeys():Array

Returns all keys in the persistent storage.

Returns
Array
getNumber()method 
public static function getNumber($key:String):Number

Reads a value from persistent storage, throwing an exception if it's not a Number.

Parameters

$key:String

Returns
Number
getString()method 
public static function getString($key:String):String

Reads a value from persistent storage, throwing an exception if it's not a String.

Parameters

$key:String

Returns
String
getStringArray()method 
public static function getStringArray($key:String):Array

Reads a value from persistent storage, throwing an exception if it's not a Array.

Parameters

$key:String

Returns
Array
getValue()method 
public static function getValue($key:String):*

Reads a value of any type from persistent storage.

Parameters

$key:String

Returns
*
init()method 
public static function init():void

refreshCache()method 
public static function refreshCache():void

grabs a refreshed copy of saved preferences from the native side and replaces with the cached object on the AIR side.

remove()method 
public static function remove($key:String):void

Removes an entry from persistent storage.

Parameters

$key:String

setBool()method 
public static function setBool($key:String, $value:Boolean):void

Saves a boolean [value] to persistent storage in the background.

Parameters

$key:String
 
$value:Boolean

setInt()method 
public static function setInt($key:String, $value:int):void

Saves an integer [value] to persistent storage in the background.

Parameters

$key:String
 
$value:int

setNumber()method 
public static function setNumber($key:String, $value:Number):void

Saves a Number [value] to persistent storage in the background.

Parameters

$key:String
 
$value:Number

setString()method 
public static function setString($key:String, $value:String):void

Saves a string [value] to persistent storage in the background. If [value] is null, this is equivalent to calling [remove()] on the [key].

Parameters

$key:String
 
$value:String

setStringArray()method 
public static function setStringArray($key:String, $value:Array):void

Saves an array of strings [value] to persistent storage in the background. If [value] is null, this is equivalent to calling [remove()] on the [key].

Parameters

$key:String
 
$value:Array

Constant Detail
EXTENSION_IDConstant
public static const EXTENSION_ID:String = com.myflashlab.air.extensions.sharedPreferences

VERSIONConstant 
public static const VERSION:String = 0.0.11