Socket
Socket
Sign inDemoInstall

superstore-sync

Package Overview
Dependencies
Maintainers
3
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

superstore-sync - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

1

bower.json
{
"name": "superstore-sync",
"version": "2.0.0",
"homepage": "https://github.com/matthew-andrews/superstore-sync",

@@ -5,0 +4,0 @@ "authors": [

38

lib/superstore-sync.js

@@ -17,11 +17,15 @@ /**

// Watch for changes from other tabs
window.addEventListener("storage", function(e) {
if (keys[e.key]) {
keys[e.key] = true;
store[e.key] = JSON.parse(e.newValue);
}
});
function Superstore(type) {
this.storage = window[type];
this.keys = {};
this.store = {};
// TODO: check the storageArea so that we only refresh the key when we need to
window.addEventListener("storage", function(e) {
if (this.keys[e.key]) {
this.keys[e.key] = true;
this.store[e.key] = JSON.parse(e.newValue);
}
}.bind(this));
}

@@ -40,3 +44,3 @@

}
if (!keys[key] && persist) {
if (!this.keys[key] && persist) {
var data;

@@ -52,6 +56,6 @@ try {

if (data) data = JSON.parse(data);
store[key] = data;
keys[key] = true;
this.store[key] = data;
this.keys[key] = true;
}
return store[key];
return this.store[key];
};

@@ -85,4 +89,4 @@

store[key] = value;
keys[key] = true;
this.store[key] = value;
this.keys[key] = true;
return value;

@@ -97,4 +101,4 @@ };

Superstore.prototype.unset = function(key) {
delete store[key];
delete keys[key];
delete this.store[key];
delete this.keys[key];
this.storage.removeItem(key);

@@ -114,4 +118,4 @@ };

}
store = {};
keys = {};
this.store = {};
this.keys = {};
return;

@@ -122,3 +126,3 @@ }

var clearKeyRegex = new RegExp("^" + clearPrefix);
for (var key in keys) {
for (var key in this.keys) {
if (key.match(clearKeyRegex)) {

@@ -125,0 +129,0 @@ this.unset(key);

{
"name": "superstore-sync",
"version": "2.0.0",
"version": "2.0.1",
"description": "Local storage, without the bugs.",

@@ -5,0 +5,0 @@ "main": "lib/superstore-sync.js",

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