amplify.store sessionStorage.

amplify.store with sessionStorage. author(s): The appendTo Team

HTML

<script src="http://cdnjs.cloudflare.com/ajax/libs/json2/20121008/json2.js"></script>
<script src="http://github.com/appendto/amplify/raw/master/lib/amplify.store.js"></script>
<p></p>

JavaScript

$( function() {
	// since we are using a specific tech
	// we are responsible for checking.
	if ( !amplify.store.types.sessionStorage ) {
		$( "p" )
			.append( "sessionStorage not available in this browser." );
		return;
	}

	// you can store any type of data using store
	// amplify will take care of serializing/deserializing
	// the data for you.
	amplify.store.sessionStorage( "explicitExample",
		{ foo2: "baz" } );

	// retrieve the data later via the key
	var myStoredValue2 =
		amplify.store.sessionStorage( "explicitExample" );

	$( "p" )
		.append( myStoredValue2.foo2 ); // baz
});