Core Docs | Additional Modules Docs
@Description: used to store data clientside. Uses localStorage if it exists
Safari, Chrome, Firefox, IE 8+ or UserData IE 6,7 or cookies if neither is available
When using IE6/7 data is restricted to the folder it was set in, otherwise it is only
restricted to the hostname.
@File: storage.js
@Author: Paul Visco
@Example:var s = new sb.storage();
s.set('name', 'paul');
s.get('name');
@Description: clears all values in storage
@File: storage.js
@Example:var s = new sb.storage();
s.clearAll();
@Description: fires before the datastore is cleared
@File: storage.js
@Example:var s = new sb.storage({
onBeforeClear : function(key){
if(this.typeOf() == 'sb.cookies'){
//do something
}
}
});
@Description: fires before set is complete so that you can do things like check the engine used
@File: storage.js
@Example:var s = new sb.storage({
onBeforeSet : function(key, val){
if(this.typeOf() == 'sb.cookies'){
//do something
}
}
});
@Description: fires before get is complete so that you can do things like check the engine used
@File: storage.js
@Example:var s = new sb.storage({
onBeforeGet : function(key){
if(this.typeOf() == 'sb.cookies'){
//do something
}
}
});
@Description: get a value by key
@File: storage.js
@Return: String Return value of the key
@Example:var s = new sb.storage();
s.get('name');
@Description: sets a key, value pair
@File: storage.js
@Return: Boolean Returns true if the key was set
@Example:var s = new sb.storage();
s.set('name', 'paul');
@Description: Gets the type of storage engine being used
@File: storage.js
@Return: String The type of storage engine being used e.g. sb.storage.local, sb.cookies, sb.userData
@Example:var s = new sb.storage();
s.clearAll();
@Description: get a value by key
@File: storage.js
@Return: String Return value of the key
@Example:var s = new sb.storage();
s.unset('name');