|
|
%!s(int64=5) %!d(string=hai) anos | |
|---|---|---|
| .. | ||
| test | %!s(int64=5) %!d(string=hai) anos | |
| .coveralls.yml | %!s(int64=5) %!d(string=hai) anos | |
| .npmignore | %!s(int64=5) %!d(string=hai) anos | |
| .travis.yml | %!s(int64=5) %!d(string=hai) anos | |
| Cakefile | %!s(int64=5) %!d(string=hai) anos | |
| LocalStorage.js | %!s(int64=5) %!d(string=hai) anos | |
| README.md | %!s(int64=5) %!d(string=hai) anos | |
| package.json | %!s(int64=5) %!d(string=hai) anos | |
Copyright (c) 2012, Lawrence S. Maccherone, Jr.
A drop-in substitute for the browser native localStorage API that runs on node.js.
localStorage['myKey'] = 'myValue' and dot property localStorage.myKey = 'myValue'
syntax. This only works if you use the --harmony-proxies flag. It senses the existence of the Proxy object in the root
scope. If you have added your own Proxy object, then you could have a problem. Another potential risk is around
the "private", underscore preceded methods and properties. I had to reserve those in addition to the standard ones,
so you won't be able to use keys that overlap with those underscore preceded properties and methods in a harmony-proxies
environment.Author: Larry Maccherone
unless localStorage?
{LocalStorage} = require('../') # require('node-localstorage') for you
localStorage = new LocalStorage('./scratch')
localStorage.setItem('myFirstKey', 'myFirstValue')
console.log(localStorage.getItem('myFirstKey'))
# myFirstValue
localStorage._deleteLocation() # cleans up ./scratch created during doctest
if (typeof localStorage === "undefined" || localStorage === null) {
var LocalStorage = require('node-localstorage').LocalStorage;
localStorage = new LocalStorage('./scratch');
}
localStorage.setItem('myFirstKey', 'myFirstValue');
console.log(localStorage.getItem('myFirstKey'));
npm install node-localstorage
ed69140)newCopyright (c) 2011, 2012, Lawrence S. Maccherone, Jr.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.