https://github.com/ruskydev/stor.js
Stor.js is a lightweight JavaScript library that provides a simple API for storing and retrieving data from localStorage.
https://github.com/ruskydev/stor.js
Last synced: about 1 year ago
JSON representation
Stor.js is a lightweight JavaScript library that provides a simple API for storing and retrieving data from localStorage.
- Host: GitHub
- URL: https://github.com/ruskydev/stor.js
- Owner: RuskyDev
- License: mit
- Created: 2023-05-09T07:31:00.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-09T10:57:21.000Z (about 3 years ago)
- Last Synced: 2025-01-24T06:11:23.228Z (over 1 year ago)
- Language: JavaScript
- Homepage: https://ruskydev.github.io/apps/stor.html
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Stor.js
Stor.js is a lightweight JavaScript library that provides a simple API for storing and retrieving data from localStorage.
# Usage
To use `Stor.js`, include the stor.js file in your HTML file:
```html
```
or
```html
```
To store data, use the `Stor.set()` function:
```javascript
Stor.set('myKey', 'myValue', {expires: 60});
```
The first argument is the key under which the data will be stored, the second argument is the value to be stored, and the third argument is an optional object containing additional options such as an expiration time in seconds.
To retrieve data, use the `Stor.get()` function:
```javascript
var myData = Stor.get('myKey', 'defaultValue');
```
The first argument is the key under which the data was stored, and the second argument is an optional default value to be returned if the key does not exist.