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

haversack

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

haversack - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

dist/storageEvent.d.ts

10

CHANGELOG.md

@@ -8,2 +8,12 @@ # Changelog

## [1.1.0] - 2020-10-17
### Added
- Add `onstorage` event handler to sync state changes between browser tabs
### Changed
- Update documentation to list bundle size
## [1.0.0] - 2020-10-17

@@ -10,0 +20,0 @@

4

dist/useStorage.js

@@ -5,2 +5,3 @@ "use strict";

var react_1 = require("react");
var storageEvent_1 = require("./storageEvent");
var utils_1 = require("./utils");

@@ -42,2 +43,5 @@ var useStorage = function (storageType, key, initialValue) {

};
storageEvent_1.registerStorageEventHandler(key, function (newValue) {
setStoredValue(newValue);
});
return {

@@ -44,0 +48,0 @@ mergeState: mergeState,

2

package.json

@@ -8,3 +8,3 @@ {

"license": "MIT",
"version": "1.0.0",
"version": "1.1.0",
"main": "dist/index.js",

@@ -11,0 +11,0 @@ "types": "dist/index.d.ts",

@@ -11,4 +11,5 @@ # Haversack

- JSON state merging
- Event handling to sync state between browser tabs
- SSR friendly, Next.js compatible
- Small and performant ⚡️
- Small and performant (no dependencies, 732B Minified + gzipped) ⚡️

@@ -165,2 +166,6 @@ `sessionStorage` is an underrepresented feature as most libraries don't support using either API interchangeably. Storing data to the session is more secure, and is perfectly suitable for many use-cases. Learn about the difference [on MDN](https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API)!

## Storage event sync
Each time you implement a Haversack hook, an `onstorage` event handler is registered. Any instance of your component on alternate browser tabs will be notified that `localStorage` has changed, and update the `value` accordingly.
## Notes on Server-Side Rendering Compatibility

@@ -167,0 +172,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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