ssp-fake-storage
v1.0.2
Published
Simulates the browser's Storage object.
Downloads
6
Maintainers
Readme
fake-storage
Node.js module to simulate the browser's Storage object (e.g. localStorage).
Use from JavaScript:
var localStorage = require('ssp-fake-storage');
localStorage.setItem('my_key', 'my_value');
localStorage.getItem('my_key'); ==> 'myvalue'
localStorage.key(0); ==> 'my_key'
Use from TypeScript:
/// <require path="typings/ssp-fake-storage.d.ts" />
import localStorage = require('ssp-fake-storage');
localStorage.setItem('my_key', 'my_value');
localStorage.getItem('my_key'); ==> 'myvalue'
localStorage.key(0); ==> 'my_key'
Methods:
Storage.setItem(key: string, value: string): void
Add an key-value pair to Storage.