From 1e2bf28341822bb3f774ffa8c49f9a16c50977b5 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 22 Jul 2011 14:17:18 -0700 Subject: [PATCH] mentioned purpose, added better usage example, added more formatting --- README.md | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f4c4a4b..f7dd256 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,23 @@ localStorage An inefficient, but as W3C-compliant as possible using only pure JavaScript, `localStorage` implementation. - var localStorage = require('localStorage'); +Purpose +---- + +This is meant for the purpose of being able to run unit-tests and such for browser-y modules in node. + +Usage +---- + + var localStorage = require('localStorage') + , myValue = { foo: 'bar', baz: 'quux' } + ; + + localStorage.setItem('myKey', JSON.stringify(myValue)); + myValue = localStorage.getItem('myKey'); API +--- * getItem(key) * setItem(key, value) @@ -15,6 +29,7 @@ API * length Tests +--- 0 === localStorage.length; null === localStorage.getItem('doesn't exist'); @@ -36,5 +51,6 @@ Tests TODO / Bugs --- - Does not persist. - Doesn't not emit `Storage` events + * Does not persist. + * could use `fs.readFileSync` at load and an occasional `fs.writeFile` to write-out localStorage.json + * Doesn't not emit `Storage` events