Class SpazPrefs
SpazPrefs
Defined in: spazprefs.js.
Constructor Attributes | Constructor Name and Description |
---|---|
SpazPrefs(defaults, sanity_methods, sanity_methods)
A preferences lib for AIR JS apps. |
Method Attributes | Method Name and Description |
---|---|
get(key, encrypted)
Get a preference Note that undefined is returned if the key does not exist |
|
getEncrypted(key)
get an encrypted preference |
|
load(name)
loads the prefs file and parses the prefs into this._prefs, or initializes the file and loads the defaults |
|
resets all prefs to defaults and saves |
|
save()
saves the current preferences |
|
set(key, val, encrypted)
set a preference and save automatically |
|
setDefaults(defaults)
sets the passed object of key:val pairs as the default preferences |
|
setEncrypted(key, val)
Sets an encrypted pref |
|
setSanityMethod(key, type, method)
|
SpazPrefs(defaults, sanity_methods, sanity_methods)
A preferences lib for AIR JS apps. This requires the json2.js library
- Parameters:
- {object} defaults
- a JS object of key:value pairs used for the pref defaults. Example: { foo:124545, bar:'Hello!', boo:false };
- {object} sanity_methods
- a JS object of key:object pairs that defines methods to be called when the pref is get() or set(). Example: { foo:{ onGet:function(key, value) {}; onSet:function(key, value) {}; }, bar:{ onGet:function(key, value) {}; onSet:function(key, value) {}; } } events raised: 'spazprefs_loaded'
- sanity_methods
get(key, encrypted)
Get a preference Note that undefined is returned if the key does not exist
- Parameters:
- key
- encrypted
load(name)
loads the prefs file and parses the prefs into this._prefs, or initializes the file and loads the defaults
- Parameters:
- name