Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/davide-gheri/storage
Small browser storage API library
https://github.com/davide-gheri/storage
cookie javascript localstorage npm sessionstorage storage typescript
Last synced: about 1 month ago
JSON representation
Small browser storage API library
- Host: GitHub
- URL: https://github.com/davide-gheri/storage
- Owner: Davide-Gheri
- Created: 2018-07-27T12:30:20.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-03T15:18:12.000Z (almost 2 years ago)
- Last Synced: 2024-10-07T23:09:01.923Z (3 months ago)
- Topics: cookie, javascript, localstorage, npm, sessionstorage, storage, typescript
- Language: TypeScript
- Homepage:
- Size: 782 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Storage
[![Build Status](https://travis-ci.org/Davide-Gheri/storage.svg?branch=master)](https://travis-ci.org/Davide-Gheri/storage)
[![Coverage Status](https://coveralls.io/repos/github/Davide-Gheri/storage/badge.svg)](https://coveralls.io/github/Davide-Gheri/storage)
[![npm version](https://badge.fury.io/js/%40davidegheri%2Fstorage.svg)](https://badge.fury.io/js/%40davidegheri%2Fstorage)
[![GitHub version](https://badge.fury.io/gh/Davide-Gheri%2Fstorage.svg)](https://badge.fury.io/gh/Davide-Gheri%2Fstorage) [![Greenkeeper badge](https://badges.greenkeeper.io/Davide-Gheri/storage.svg)](https://greenkeeper.io/)### Small browser storage API library
#### Usage
```javascript
var storage = new Storage('localstorage');
storage.set('key', 'hello world'); // true
storage.get('key') // hello world
```Available adapters:
- localstorage : Use the window.localstorage
- sessionstorage : Use the window.sessionstorage
- cookie : Use the document.cookie string##### Methods
__set(key, value, options? (cookie only)): boolean__
_set the given value in the storage by the given key, options: for cookie storage you can pass storing options that overwrites the defaults_
__get(key, default?): any__
_get the value from the storage by the given key, optional default value is returned if nothing is found_
__delete(key): boolean__
_remove the value from the storage by the given key_
__clear(): void__
_remove all values from the storage_