# @thefarce/ripple-browser-storage

> A browser storage persistence layer for @thefarce/ripple

Latest version **0.4.0** (published 2024-02-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install @thefarce/ripple-browser-storage
pnpm add @thefarce/ripple-browser-storage
yarn add @thefarce/ripple-browser-storage
bun add @thefarce/ripple-browser-storage
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.0 |
| Published | 2024-02-14 |
| First published | 2024-01-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 10.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Sir Robert Burbridge |
| Maintainers | sirrobert |
| Keywords | browser, storage, db, localstorage, sessionstorage, ripple, thefarce |

## Links

- npm: https://www.npmjs.com/package/@thefarce/ripple-browser-storage
- Repository: https://bitbucket.org/thefarce/ripple-browser-storage
- Homepage: https://bitbucket.org/thefarce/ripple-browser-storage#readme
- Issues: https://bitbucket.org/thefarce/ripple-browser-storage/issues
- npm.io page: https://npm.io/package/@thefarce/ripple-browser-storage

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [mongoose-typescript](https://npm.io/package/mongoose-typescript.md) — 85 weekly downloads

## Recent versions

- 0.4.0 (latest) — 2024-02-14
- 0.3.0 — 2024-01-30

## README

# @thefarce/ripple-browser-storage

A browser storage persistence layer for `@thefarce/ripple`, providing an easy interface to interact with `localStorage` and `sessionStorage`.

## Features

- Seamless integration with `localStorage` and `sessionStorage`.
- Easy-to-use API for storing and retrieving data.
- Customizable storage options.
- Lightweight and no external dependencies.

## Installation

Install the package using npm:

```bash
npm install @thefarce/ripple-browser-storage
```

Or using yarn:

```bash
yarn add @thefarce/ripple-browser-storage
```

## Usage

Here's how to use `@thefarce/ripple-browser-storage` in your project.

### Basic Usage

```javascript
import { storeInBrowser } from '@thefarce/ripple-browser-storage';

// Store data in sessionStorage (default)
storeInBrowser({
  namespace: 'myApp',
  key: 'userData',
  data: { name: 'John Doe', age: 30 }
});

// Retrieve data
const userData = sessionStorage.getItem('myApp::userData');
console.log(JSON.parse(userData)); // Outputs: { name: 'John Doe', age: 30 }
```

### Storing Data in localStorage

```javascript
// Store data in localStorage
storeInBrowser({
  namespace: 'myApp',
  key: 'settings',
  data: { theme: 'dark', notifications: true },
  metadata: { storageType: 'local' }
});

// Retrieve data
const settings = localStorage.getItem('myApp::settings');
console.log(JSON.parse(settings)); // Outputs: { theme: 'dark', notifications: true }
```

### Advanced Usage

Here are some advanced scenarios for using `@thefarce/ripple-browser-storage`:

```javascript
// Example 1: Clearing data from a specific namespace
storeInBrowser.clearNamespace('myApp');

// Example 2: Using async/await for storing data
async function storeUserData() {
  await storeInBrowser({
    namespace: 'myApp',
    key: 'asyncData',
    data: { message: 'Hello World' }
  });
}
storeUserData();
```

## API Reference

- `storeInBrowser(options)`: Function to store data in browser storage.

  **Options**:
  - `namespace`: A unique identifier for your app/module.
  - `key`: The key under which to store the data.
  - `data`: The data to be stored.
  - `metadata`: (Optional) Additional configuration, such as `storageType`.

## Contributing

Contributions to `@thefarce/ripple-browser-storage` are welcome!

- Fork the repository.
- Create a new branch for each feature or improvement.
- Send a pull request from each feature branch to the main branch.

## Contributing

We welcome contributions to `@thefarce/ripple`!

Contribution guidelines:  Commit clean code with full, good tests.  Comment
your code as needed.

## License

This project is licensed under the Gratitude License - see the LICENSE.txt
file for details.

---
_Source: https://npm.io/package/@thefarce/ripple-browser-storage · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
