$storage.get
Get storaged data.
$storage.get( name )
name [string]
The name of value.
Notes
Qatrix storage function provided a great data storage capacity with over 128KB+ in IE6-7 and 5MB-10MB in browser supported local storage. The storaged data can still fetch it even the browser is closed and reloaded, or the cookie is cleaned up. It can get the data and use it as object without parsing the value.
Example
HTML code
<div id="message"></div> <button onclick="start_storage_get()">Get data from storage</button> <button onclick="start_storage_set()">Store data to storage</button> <button onclick="start_storage_remove()">Remove data from storage</button>
JavaScript code
function start_storage_get()
{
var mydata = $storage.get( "mydata" );
if (mydata)
{
$html($("message"), "The value of mydata from storage is '" + $storage.get("mydata") + "'<br />The value of data.name from storage is '" + $storage.get("mydata").name + "'");
}
else
{
$html($("message"), "No mydata from storage.");
}
}
function start_storage_set()
{
var data = {
"name": "Tom",
"age": 18,
"city": "New York"
};
$storage.set("mydata", data);
alert("The data storaged successfully. Try to close or reload the browser, or clean up the cookie and then get the value from this page");
}
function start_storage_remove()
{
$storage.remove("mydata");
$html($("message"), "The 'mydata' is removed");
}