New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cross-domain-storage

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cross-domain-storage - npm Package Compare versions

Comparing version 2.0.7 to 2.1.0-beta.0

19

distribution/guest/index.js

@@ -118,2 +118,18 @@ 'use strict';

function getSession(key, callback) {
if (!callback) {
throw new Error('callback required for get');
}
message('getSession', key, null, callback);
}
function setSession(key, value, callback) {
message('setSession', key, value, callback);
}
function removeSession(key, callback) {
message('removeSession', key, null, callback);
}
function checkConnected() {

@@ -138,4 +154,7 @@ if (connected) {

remove: remove,
getSession: getSession,
setSession: setSession,
removeSession: removeSession,
close: close
};
};

23

distribution/host/methods.js
'use strict';
var connectId = 'sessionAccessId-connected';
var LOCAL_STORAGE = 'localStorage';
var SESSION_STORAGE = 'sessionStorage';
module.exports = {
get: function get(event, data) {
var storageType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : LOCAL_STORAGE;
event.source.postMessage({
id: data.id,
data: window.localStorage.getItem(data.key)
data: window[storageType].getItem(data.key)
}, event.origin);
},
set: function set(event, data) {
window.localStorage.setItem(data.key, data.value);
var storageType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : LOCAL_STORAGE;
window[storageType].setItem(data.key, data.value);
event.source.postMessage({

@@ -20,4 +26,6 @@ id: data.id

remove: function remove(event, data) {
window.localStorage.removeItem(data.key);
var storageType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : LOCAL_STORAGE;
window[storageType].removeItem(data.key);
event.source.postMessage({

@@ -27,2 +35,11 @@ id: data.id

},
getSession: function getSession(event, data) {
this.get(event, data, SESSION_STORAGE);
},
setSession: function setSession(event, data) {
this.set(event, data, SESSION_STORAGE);
},
removeSession: function removeSession(event, data) {
this.remove(event, data, SESSION_STORAGE);
},
connect: function connect(event) {

@@ -29,0 +46,0 @@ event.source.postMessage({

2

package.json
{
"name": "cross-domain-storage",
"version": "2.0.7",
"version": "2.1.0-beta.0",
"description": "Cross domain local storage",

@@ -5,0 +5,0 @@ "main": "./",

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