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

dot-store-message

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dot-store-message - npm Package Compare versions

Comparing version 2.6.13 to 2.6.19

211

dist/index.js

@@ -12,99 +12,158 @@ "use strict";

var _getIterator2 = _interopRequireDefault(require("@babel/runtime/core-js/get-iterator"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
function _default(store) {
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
_ref$key = _ref.key,
key = _ref$key === void 0 ? "iframes" : _ref$key;
function _default(key) {
return function (store) {
if (typeof window === "undefined" || !key) {
return store;
}
if (typeof window === "undefined") {
return store;
}
store.on("".concat(key, ".{divId}"),
/*#__PURE__*/
function () {
var _ref2 = (0, _asyncToGenerator2.default)(
store.on(key,
/*#__PURE__*/
_regenerator.default.mark(function _callee(options) {
var divId, meta, op, prop, value, iframe, valid, message, el, target;
return _regenerator.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
divId = options.divId, meta = options.meta, op = options.op, prop = options.prop, value = options.value;
iframe = store.get("".concat(key, ".").concat(divId));
valid = iframe && !iframe.dfp;
function () {
var _ref = (0, _asyncToGenerator2.default)(
/*#__PURE__*/
_regenerator.default.mark(function _callee(options) {
var meta, op, prop, store, value, ids, message, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _id, el;
if (!(!valid || meta.fromWindow)) {
_context.next = 5;
break;
}
return _regenerator.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
meta = options.meta, op = options.op, prop = options.prop, store = options.store, value = options.value;
ids = store.get("dotStore.messageIds");
return _context.abrupt("return");
if (!ids) {
store.set("dotStore.messageIds", []);
}
case 5:
message = {
dotStore: true,
op: op,
prop: prop,
value: value
};
el = document.getElementById(divId);
if (!meta.fromWindow) {
_context.next = 5;
break;
}
if (!(el && !el.firstChild)) {
_context.next = 9;
break;
}
return _context.abrupt("return");
return _context.abrupt("return");
case 5:
message = {
dotStore: true,
op: op,
prop: prop,
value: value
};
case 9:
if (!(!el && window.parent == window)) {
_context.next = 11;
if (!(ids && ids.length)) {
_context.next = 37;
break;
}
_iteratorNormalCompletion = true;
_didIteratorError = false;
_iteratorError = undefined;
_context.prev = 10;
_iterator = (0, _getIterator2.default)(ids);
case 12:
if (_iteratorNormalCompletion = (_step = _iterator.next()).done) {
_context.next = 21;
break;
}
_id = _step.value;
el = document.getElementById(_id);
if (!(el && !el.firstChild)) {
_context.next = 17;
break;
}
return _context.abrupt("return");
case 17:
el.firstChild.contentWindow.postMessage(message, "*");
case 18:
_iteratorNormalCompletion = true;
_context.next = 12;
break;
}
return _context.abrupt("return");
case 21:
_context.next = 27;
break;
case 11:
target = el ? el.firstChild.contentWindow : window.parent;
case 23:
_context.prev = 23;
_context.t0 = _context["catch"](10);
_didIteratorError = true;
_iteratorError = _context.t0;
if (target) {
target.postMessage(message, "*");
}
case 27:
_context.prev = 27;
_context.prev = 28;
case 13:
case "end":
return _context.stop();
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}
case 30:
_context.prev = 30;
if (!_didIteratorError) {
_context.next = 33;
break;
}
throw _iteratorError;
case 33:
return _context.finish(30);
case 34:
return _context.finish(27);
case 35:
_context.next = 38;
break;
case 37:
if (window.parent != window) {
window.parent.postMessage(message, "*");
}
case 38:
case "end":
return _context.stop();
}
}
}
}, _callee, this);
}));
}, _callee, this, [[10, 23, 27, 35], [28,, 30, 34]]);
}));
return function (_x) {
return _ref2.apply(this, arguments);
};
}());
window.addEventListener("message", function (_ref3) {
var data = _ref3.data,
origin = _ref3.origin;
return function (_x) {
return _ref.apply(this, arguments);
};
}());
window.addEventListener("message", function (_ref2) {
var data = _ref2.data,
origin = _ref2.origin;
if (origin == window.location.origin) {
return;
}
if (origin == window.location.origin) {
return;
}
var dotStore = data.dotStore,
op = data.op,
prop = data.prop,
value = data.value;
var dotStore = data.dotStore,
op = data.op,
prop = data.prop,
value = data.value;
if (dotStore) {
store[op](prop, value, {
fromWindow: true
});
}
}, false);
return store;
if (dotStore) {
store[op](prop, value, {
fromWindow: true
});
}
}, false);
return store;
};
}
//# sourceMappingURL=index.js.map
{
"name": "dot-store-message",
"version": "2.6.13",
"version": "2.6.19",
"description": "Store sync using window.postMessage",

@@ -5,0 +5,0 @@ "keywords": [

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