<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>localStorage &#8211; stoimen&#039;s web log</title>
	<atom:link href="/tag/localstorage/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>on web development</description>
	<lastBuildDate>Tue, 13 Feb 2018 08:18:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.3</generator>
	<item>
		<title>jQuery localStorage plugin (alpha)</title>
		<link>/2010/02/26/jquery-localstorage-plugin-alpha/</link>
		<comments>/2010/02/26/jquery-localstorage-plugin-alpha/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 07:20:04 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[JavaScript programming language]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[localStorage]]></category>

		<guid isPermaLink="false">/?p=1150</guid>
		<description><![CDATA[After submitting the HTML5 localStorage wrap plugin for jQuery, there comes the new version, hopefully more stable and reliable! (function(jQuery) { var supported = true; if (typeof localStorage == 'undefined' &#124;&#124; typeof JSON == 'undefined') supported = false; else var ls = localStorage; this.setItem = function(key, value, lifetime) { if (!supported) return false; if (typeof &#8230; <a href="/2010/02/26/jquery-localstorage-plugin-alpha/" class="more-link">Continue reading <span class="screen-reader-text">jQuery localStorage plugin (alpha)</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/02/25/jquery-localstorage-plugin/" rel="bookmark" title="jQuery localStorage plugin">jQuery localStorage plugin </a></li>
<li><a href="/2010/02/24/storing-javascript-objects-in-html5-localstorage/" rel="bookmark" title="Storing JavaScript objects in html5 localStorage">Storing JavaScript objects in html5 localStorage </a></li>
<li><a href="/2010/02/17/clickoutside-jquery-plugin/" rel="bookmark" title="clickoutside jQuery plugin">clickoutside jQuery plugin </a></li>
<li><a href="/2010/02/01/writing-a-jquery-plugin-part-2-sample-plugin/" rel="bookmark" title="Writing a jQuery plugin &#8211; (part 2). Sample plugin.">Writing a jQuery plugin &#8211; (part 2). Sample plugin. </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>After submitting the HTML5 localStorage wrap plugin for jQuery, there comes the new version, hopefully more stable and reliable!</p>
<pre lang="javascript" line="1">
(function(jQuery) {

   var supported = true;
   if (typeof localStorage == 'undefined' || typeof JSON == 'undefined')
      supported = false;
   else
      var ls = localStorage;

   this.setItem = function(key, value, lifetime) {
      if (!supported)
         return false;

      if (typeof lifetime == 'undefined')
         lifetime = 60000;

      ls.setItem(key, JSON.stringify(value));
      var time = new Date();
      ls.setItem('meta_ct_'+key, time.getTime());
      ls.setItem('meta_lt_'+key, lifetime);
   };

   this.getItem = function(key) {
      if (!supported)
         return false;

      var time = new Date();
      if (time.getTime() - ls.getItem('meta_ct_'+key) &gt; ls.getItem('meta_lt_'+key)) {
         ls.removeItem(key);
         ls.removeItem('meta_ct_'+key);
         ls.removeItem('meta_lt_'+key);
         return false;
      }
      return JSON.parse(ls.getItem(key));
   };

   this.removeItem = function(key) {
      if (!supported)
         return false;

      ls.removeItem(key);
      ls.removeItem('meta_ct_'+key);
      ls.removeItem('meta_lt_'+key);
      return true;
   };

   jQuery.localStorage = this;

})(jQuery);

if (!$.localStorage.getItem('test')) {
   $.localStorage.setItem('test', ['stoimen'], 5000);
   console.log('dynamic');
} else {
   console.log('from cache');
}</pre>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/02/25/jquery-localstorage-plugin/" rel="bookmark" title="jQuery localStorage plugin">jQuery localStorage plugin </a></li>
<li><a href="/2010/02/24/storing-javascript-objects-in-html5-localstorage/" rel="bookmark" title="Storing JavaScript objects in html5 localStorage">Storing JavaScript objects in html5 localStorage </a></li>
<li><a href="/2010/02/17/clickoutside-jquery-plugin/" rel="bookmark" title="clickoutside jQuery plugin">clickoutside jQuery plugin </a></li>
<li><a href="/2010/02/01/writing-a-jquery-plugin-part-2-sample-plugin/" rel="bookmark" title="Writing a jQuery plugin &#8211; (part 2). Sample plugin.">Writing a jQuery plugin &#8211; (part 2). Sample plugin. </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/02/26/jquery-localstorage-plugin-alpha/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
