dot-store-iframe
Advanced tools
Comparing version 2.6.7 to 2.6.13
@@ -127,3 +127,3 @@ "use strict"; | ||
_regenerator.default.mark(function _callee2(options) { | ||
var iframeId, prev, props, state, store, dfp, iframes, iframe, valid, divId, _iframe$dfp, oop, path, targets, unitId, unit, slot, sizeMap, key; | ||
var iframe, store, _store$get, dfp, divId, _iframe$dfp, oop, path, targets, unitId, unit, slot, sizeMap, key; | ||
@@ -134,9 +134,7 @@ return _regenerator.default.wrap(function _callee2$(_context2) { | ||
case 0: | ||
iframeId = options.iframeId, prev = options.prev, props = options.props, state = options.state, store = options.store; | ||
dfp = state.dfp, iframes = state.iframes; | ||
iframe = iframes[iframeId]; | ||
valid = iframe && iframe.dfp; | ||
iframe = options.listenValue, store = options.store; | ||
_store$get = store.get(), dfp = _store$get.dfp; | ||
if (!(!valid || props.length != 2 || prev)) { | ||
_context2.next = 6; | ||
if (iframe.dfp) { | ||
_context2.next = 4; | ||
break; | ||
@@ -147,7 +145,7 @@ } | ||
case 6: | ||
_context2.next = 8; | ||
case 4: | ||
_context2.next = 6; | ||
return store.onceExists("dfp.loaded"); | ||
case 8: | ||
case 6: | ||
divId = iframe.divId; | ||
@@ -184,3 +182,3 @@ _iframe$dfp = iframe.dfp, oop = _iframe$dfp.oop, path = _iframe$dfp.path, targets = _iframe$dfp.targets, unitId = _iframe$dfp.unitId; | ||
case 14: | ||
case 12: | ||
case "end": | ||
@@ -310,3 +308,3 @@ return _context2.stop(); | ||
case 3: | ||
targets = store.getSync("dfp.targets") || {}; | ||
targets = store.get("dfp.targets") || {}; | ||
@@ -313,0 +311,0 @@ for (key in targets) { |
@@ -11,2 +11,3 @@ "use strict"; | ||
exports.iframeSize = iframeSize; | ||
exports.addDebug = addDebug; | ||
@@ -28,3 +29,3 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator")); | ||
_regenerator.default.mark(function _callee(options) { | ||
var iframeId, prev, props, state, store, iframes, iframe, valid, divId, url, loaded, onLoad, el; | ||
var iframeId, listenValue, store, divId, url, loaded, onLoad, el; | ||
return _regenerator.default.wrap(function _callee$(_context) { | ||
@@ -34,9 +35,6 @@ while (1) { | ||
case 0: | ||
iframeId = options.iframeId, prev = options.prev, props = options.props, state = options.state, store = options.store; | ||
iframes = state.iframes; | ||
iframe = iframes[iframeId]; | ||
valid = iframe && !iframe.dfp; | ||
iframeId = options.iframeId, listenValue = options.listenValue, store = options.store; | ||
if (!(!valid || props.length != 2 || prev)) { | ||
_context.next = 6; | ||
if (listenValue.dfp) { | ||
_context.next = 3; | ||
break; | ||
@@ -47,4 +45,4 @@ } | ||
case 6: | ||
divId = iframe.divId, url = iframe.url; | ||
case 3: | ||
divId = listenValue.divId, url = listenValue.url; | ||
loaded = "iframes.".concat(iframeId, ".loaded"); | ||
@@ -60,7 +58,10 @@ | ||
el.height = 0; | ||
el.src = url; | ||
el.src = addDebug({ | ||
store: store, | ||
url: url | ||
}); | ||
document.getElementById(divId).appendChild(el); | ||
elements[divId] = el; | ||
case 16: | ||
case 13: | ||
case "end": | ||
@@ -140,3 +141,16 @@ return _context.stop(); | ||
} | ||
} // Helpers | ||
function addDebug(_ref2) { | ||
var store = _ref2.store, | ||
url = _ref2.url; | ||
if (!store.get("debugMode")) { | ||
return; | ||
} | ||
var separator = url.indexOf("?") < 0 ? "?" : "&"; | ||
return url + "".concat(separator, "store_debug=1"); | ||
} | ||
//# sourceMappingURL=iframes.js.map |
@@ -16,7 +16,7 @@ "use strict"; | ||
function _default(store) { | ||
store.on("iframes.{iframeId}", _iframes.createIframe); | ||
store.onceExists("iframes.{iframeId}", _iframes.createIframe); | ||
store.onceExists("iframes.{iframeId}", _dfp.createDfpSlot); | ||
store.on("iframes.{iframeId}.height", _iframes.iframeSize); | ||
store.on("iframes.{iframeId}.width", _iframes.iframeSize); | ||
store.on("dfp.targets", _dfp.updateDfpTargets); | ||
store.on("iframes.{iframeId}", _dfp.createDfpSlot); | ||
store.on("iframes.{iframeId}.refresh", _dfp.refreshDfpSlot); | ||
@@ -23,0 +23,0 @@ store.on("afterDelete", "iframes.{iframeId}", _dfp.deleteDfpSlot); |
{ | ||
"name": "dot-store-iframe", | ||
"version": "2.6.7", | ||
"version": "2.6.13", | ||
"description": "Iframe controller integration for dot-store", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
406
31231