Twitter: raymondcamden


Address: Lafayette, LA, USA

Meanwhile, over in IndexedDB land...

12-13-2013 2,865 views JavaScript, HTML5 Comments

Ok, this probably won't interest anyone but me, but I thought it was kind of interesting and I thought I'd share. On Wednesday, Firefox 26 was released, and one of the cooler things they did was to document the updates that are of interest to developers. You can read this here: Firefox 26. In general, this is pretty darn cool of the Mozillians. Obviously FF26 has other user-centric changes that may be interesting, but as a developer, I honestly don't care about anything else.

One of the interesting notes in this release was this:

IndexedDB can now be used as a "optimistic" storage area so it doesn't require any prompts and data is stored in a pool with LRU eviction policy, in short temporary storage

Cool, right? Essentially it means you can use IndexedDB for storage when LocalStorage doesn't make sense, and have the benefit of being automatically cleaned up in the future. So basically - temporary data of a larger possible size than LocalStorage.

If you follow the bugzilla link you will see that the only change is in the open request. Instead of using "name,version" as the arguments you pass in an object instead. Here is an example.

window.indexedDB.open({name:"nsa_secrets",version:1,storage:"temporary"});

In case you're wondering, no, this is not in the official spec, but it will soon be supported by Chrome and I'm sure the Mozillians will submit this to the spec as an update.

Speaking of Chrome, you do not want to use this on a Chrome system. It will essentially run toString on the object and use [object Object] as the database name.

p.s. So hey, how did I find this? The excellent Open Web Platform Daily Digest.

0 Comments

Post Reply

Please refrain from posting large blocks of code as a comment. Use Pastebin or Gists instead. Text wrapped in asterisks (*) will be bold and text wrapped in underscores (_) will be italicized.

Leave this field empty