Skip to content

Commit

Permalink
Add warning about rename
Browse files Browse the repository at this point in the history
  • Loading branch information
joshnuss committed Oct 4, 2023
1 parent 1d0335f commit ae01aa4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 53 deletions.
53 changes: 1 addition & 52 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,4 @@

# svelte-local-storage-store

A Svelte store that persists to local storage. Supports changes across multiple tabs.

## Installation

```bash
npm install svelte-local-storage-store
```

## Usage

Define the store:

```javascript
import { persisted } from 'svelte-local-storage-store'

// First param `preferences` is the local storage key.
// Second param is the initial value.
export const preferences = persisted('preferences', {
theme: 'dark',
pane: '50%',
...
})
```

Then when you want to use the store:

```javascript
import { get } from 'svelte/store'
import { preferences } from './stores'

preferences.subscribe(...) // subscribe to changes
preferences.update(...) // update value
preferences.set(...) // set value
get(preferences) // read value
$preferences // read value with automatic subscription
```

You can also optionally set the `serializer` or `storage` type:

```javascript
import * as devalue from 'devalue'

// third parameter is options.
export const preferences = persisted('local-storage-key', 'default-value', {
serializer: devalue, // defaults to `JSON`
storage: 'session' // 'session' for sessionStorage, defaults to 'local'
})
```

## License

MIT
**Package has been renamed to [svelte-presisted-store](https://www.npmjs.com/package/svelte-persisted-store)**
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "svelte-local-storage-store",
"version": "0.0.0-development",
"version": "0.6.4",
"license": "MIT",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand Down

0 comments on commit ae01aa4

Please sign in to comment.