# @wranggle/storage-local-forage-adapter

> Use LocalForage as underlying store for WranggleStorage feature layers

Latest version **0.2.4** (published 2019-03-22) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @wranggle/storage-local-forage-adapter
pnpm add @wranggle/storage-local-forage-adapter
yarn add @wranggle/storage-local-forage-adapter
bun add @wranggle/storage-local-forage-adapter
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.4 |
| Published | 2019-03-22 |
| First published | 2019-03-19 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 37.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jeff Ferber |
| Maintainers | wranggle.ferbs |
| Keywords | wranggle-storage, storage, persistence, middleware, localforage |

## Links

- npm: https://www.npmjs.com/package/@wranggle/storage-local-forage-adapter
- Repository: https://github.com/wranggle/storage
- Issues: https://github.com/wranggle/storage/issues
- npm.io page: https://npm.io/package/@wranggle/storage-local-forage-adapter

## Dependencies (1)

- [@wranggle/storage-core](https://npm.io/package/@wranggle/storage-core.md) ^0.2.4

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.2.4 (latest) — 2019-03-22
- 0.2.3 — 2019-03-21
- 0.2.2 — 2019-03-19
- 0.2.1 — 2019-03-19

## README

# LocalForageAdapter

The LocalForageAdapter lets [WranggleStorage](https://github.com/wranggle/storage) use [LocalForage](https://github.com/localForage/localForage) as its underlying persistent store.

The LocalForage library itself is not bundled in with this adapter. The instructions below assume you've already [installed it](https://localforage.github.io/localForage/#installation). 


## Constructing WranggleStorage with LocalForage

You can apply this adapter using the `localForage` shortcut when constructing your WranggleStorage instance. Eg:
```javascript
const store = new WranggleStorage({ localForage });
```

Or if localForage is available on window/global and you are ok with its defaults, you can use its minimal setup:
```javascript
const store = new WranggleStorage({ localForage: true });
```

If you want to change the LocalForage configuration (eg, forcing a specific driver / storage location) pass WranggleStorage the already-configured LocalForage instance you want. Eg:

```javascript
const lf = localforage.createInstance({ driver: localforage.WEBSQL }); // or localforage.config(opts) 
const store = new WranggleStorage({ localForage: lf });
```


## Installing From Individual Packages

For a web page, it is easiest to use the [@wranggle/storage-web](https://github.com/wranggle/storage-web-full) bundle.

Or you can add/install individual packages:

1. Add the [@wranggle/storage-core](https://www.npmjs.com/package/@wranggle/storage-core) and [@wranggle/storage-local-forage-adapter](https://www.npmjs.com/package/@wranggle/storage-local-forage-adapter) packages to your project:
    ```bash
    # From the command line using yarn:
    yarn add @wranggle/storage-core @wranggle/storage-local-forage-adapter
    
    # or with npm:
    npm install @wranggle/storage-core @wranggle/storage-local-forage-adapter
    ```

1. In your JavaScript, import or require the packages: 
    ```javascript
    import WranggleStorage from '@wranggle/storage-core'; 
    import LocalForageAdapter from '@wranggle/storage-local-forage-adapter'
    // or:
    const WranggleStorage = require('@wranggle/storage-core');
    const LocalForageAdapter = require('@wranggle/storage-local-forage-adapter')
    ```

1. Instantiate your store:
    ```javascript
    const store = new WranggleStorage({ localForage });
    ```
    Or do so without the construction shortcut:
    ```javascript
    const store = new WranggleStorage({ persist: new LocalForageAdapter({ localForage }));
    ```

---
_Source: https://npm.io/package/@wranggle/storage-local-forage-adapter · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
