Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

choo-persist

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

choo-persist - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

13

index.js

@@ -24,3 +24,7 @@ var mutate = require('xtend/mutable')

bus.removeListener('*', listener)
window.localStorage.removeItem(name)
try {
window.localStorage.removeItem(name)
} catch (e) {
bus.emit('log:warn', 'Coun not wipe localStorage ' + name)
}
bus.emit('log:warn', 'Wiping localStorage ' + name)

@@ -31,5 +35,10 @@ })

var savedState = filter ? filter(state) : state
window.localStorage.setItem(name, JSON.stringify(savedState))
try {
window.localStorage.setItem(name, JSON.stringify(savedState))
} catch (e) {
bus.removeListener('*', listener)
bus.emit('log:warn', 'Cound not set item to localStorage ' + name)
}
}
}
}

2

package.json
{
"name": "choo-persist",
"version": "3.0.0",
"version": "3.0.1",
"description": "Synchronize choo state with indexedDB",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -5,3 +5,4 @@ # choo-persist [![stability][0]][1]

Synchronize [choo][choo] state with `localStorage`
Persist [choo][choo] state to [localStorage][mdn]. localStorage is supported
by [all major browsers][caniuse].

@@ -20,8 +21,7 @@ ## Usage

### `instance = persist([opts])`
Create a new `indexedDB` database instance, and call the callback with the
plugin when done. Can take an optional first argument of options:
- __opts.name:__ default `'app'`; provide a name for the indexedDB database
- __opts.filter(state):__ modify the state that's about to be written to the
IndexedDB database. Useful to strip values that cannot be serialized to
IndexedDB.
Load the app state from `localStorage` and set up listeners to write the state
back on every event. Can take an optional argument of options:
- __opts.name:__ default `'choo-persist'`; the `localStorage` key.
- __opts.filter(state):__ modify the state that's about to be saved. Useful
for removing values that cannot be serialized to JSON.

@@ -70,4 +70,4 @@ ```js

[11]: https://github.com/feross/standard
[caniuse]: http://caniuse.com/#feat=indexeddb
[mdn]: https://developer.mozilla.org/en/docs/Web/API/IndexedDB_API
[caniuse]: http://caniuse.com/#feat=namevalue-storage
[mdn]: https://developer.mozilla.org/en-US/docs/Web/API/Storage/LocalStorage
[choo]: https://github.com/yoshuawuyts/choo
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc