webext-redux
Advanced tools
Comparing version 2.1.7 to 2.1.8
@@ -1099,2 +1099,9 @@ (function (global, factory) { | ||
}, null, function (resp) { | ||
if (!resp) { | ||
var _error = _this3.browserAPI.runtime.lastError; | ||
var bgErr = new Error("".concat(backgroundErrPrefix).concat(_error)); | ||
reject(lodash_assignin(bgErr, _error)); | ||
return; | ||
} | ||
var error = resp.error, | ||
@@ -1104,4 +1111,5 @@ value = resp.value; | ||
if (error) { | ||
var bgErr = new Error("".concat(backgroundErrPrefix).concat(error)); | ||
reject(lodash_assignin(bgErr, error)); | ||
var _bgErr = new Error("".concat(backgroundErrPrefix).concat(error)); | ||
reject(lodash_assignin(_bgErr, error)); | ||
} else { | ||
@@ -1108,0 +1116,0 @@ resolve(value && value.payload); |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).WebextRedux={})}(this,(function(e){"use strict";function t(e,t){for(var r=0;t.length>r;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function r(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e){for(var t=1;arguments.length>t;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){r(e,t,n[t])}))}return e}function o(e){return function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);e.length>t;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var i=9007199254740991,a="[object Arguments]",s="[object Function]",u="[object GeneratorFunction]",c=/^(?:0|[1-9]\d*)$/;function l(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var f=Object.prototype,d=f.hasOwnProperty,p=f.toString,h=f.propertyIsEnumerable,y=Math.max;function v(e,t){var r=P(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&j(e)}(e)&&d.call(e,"callee")&&(!h.call(e,"callee")||p.call(e)==a)}(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],n=r.length,o=!!n;for(var i in e)!t&&!d.call(e,i)||o&&("length"==i||b(i,n))||r.push(i);return r}function g(e,t,r){var n=e[t];d.call(e,t)&&w(n,r)&&(void 0!==r||t in e)||(e[t]=r)}function m(e){if(!A(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t,r,n=(t=e)===("function"==typeof(r=t&&t.constructor)&&r.prototype||f),o=[];for(var i in e)("constructor"!=i||!n&&d.call(e,i))&&o.push(i);return o}function b(e,t){return!!(t=null==t?i:t)&&("number"==typeof e||c.test(e))&&e>-1&&e%1==0&&t>e}function w(e,t){return e===t||e!=e&&t!=t}var S,E,x,P=Array.isArray;function j(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&i>=e}(e.length)&&!function(e){var t=A(e)?p.call(e):"";return t==s||t==u}(e)}function A(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}var O=(S=function(e,t){!function(e,t,r,n){r||(r={});for(var o=-1,i=t.length;++o<i;){var a=t[o],s=n?n(r[a],e[a],a,r,e):void 0;g(r,a,void 0===s?e[a]:s)}}(t,function(e){return j(e)?v(e,!0):m(e)}(t),e)},E=function(e,t){var r=-1,n=t.length,o=n>1?t[n-1]:void 0,i=n>2?t[2]:void 0;for(o=S.length>3&&"function"==typeof o?(n--,o):void 0,i&&function(e,t,r){if(!A(r))return!1;var n=typeof t;return!!("number"==n?j(r)&&b(t,r.length):"string"==n&&t in r)&&w(r[t],e)}(t[0],t[1],i)&&(o=3>n?void 0:o,n=1),e=Object(e);++r<n;){var a=t[r];a&&S(e,a,r,o)}return e},x=y(void 0===x?E.length-1:x,0),function(){for(var e=arguments,t=-1,r=y(e.length-x,0),n=Array(r);++t<r;)n[t]=e[x+t];t=-1;for(var o=Array(x+1);++t<x;)o[t]=e[t];return o[x]=n,l(E,this,o)}),k="chromex.state",z="chromex.patch_state",M=function(e){return e},N=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:M;return n({},e,e.payload?{payload:t(e.payload)}:{})},R=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:M,r=arguments.length>2?arguments[2]:void 0;return r?function(n){for(var o=arguments.length,i=Array(o>1?o-1:0),a=1;o>a;a++)i[a-1]=arguments[a];return r.apply(void 0,[n].concat(i))?e.apply(void 0,[N(n,t)].concat(i)):e.apply(void 0,[n].concat(i))}:function(r){for(var n=arguments.length,o=Array(n>1?n-1:0),i=1;n>i;i++)o[i-1]=arguments[i];return e.apply(void 0,[N(r,t)].concat(o))}},I=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:M;return function(t){return function(r,n){return t(R(r,e,n))}}},L=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:M;return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return function(){for(var n=arguments.length,o=Array(n),i=0;n>i;i++)o[i]=arguments[i];if(r>=o.length)throw Error("Message in request could not be serialized. "+"Expected message in position ".concat(r," but only received ").concat(o.length," args."));return o[r]=N(o[r],e),t.apply(void 0,o)}}},_="updated",C="removed";function H(){var e;try{e=self.chrome||self.browser||browser}catch(t){e=browser}if(!e)throw Error("Browser API is not present");return e}var q={portName:"chromex.port_name",state:{},extensionId:null,serializer:M,deserializer:M,patchStrategy:function(e,t){var r=Object.assign({},e);return t.forEach((function(e){var t=e.key,n=e.value;switch(e.change){case _:r[t]=n;break;case C:Reflect.deleteProperty(r,t)}})),r}};function D(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}var F={portName:"chromex.port_name",dispatchResponder:function(e,t){Promise.resolve(e).then((function(e){t({error:null,value:e})})).catch((function(e){console.error("error dispatching result:",e),t({error:e.message,value:null})}))},serializer:M,deserializer:M,diffStrategy:function(e,t){var r=[];return Object.keys(t).forEach((function(n){e[n]!==t[n]&&r.push({key:n,value:t[n],change:_})})),Object.keys(e).forEach((function(e){t.hasOwnProperty(e)||r.push({key:e,change:C})})),r}};e.Store=function(){function e(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:q,n=r.portName,o=void 0===n?q.portName:n,i=r.state,a=void 0===i?q.state:i,s=r.extensionId,u=void 0===s?q.extensionId:s,c=r.serializer,l=void 0===c?q.serializer:c,f=r.deserializer,d=void 0===f?q.deserializer:f,p=r.patchStrategy,h=void 0===p?q.patchStrategy:p;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!o)throw Error("portName is required in options");if("function"!=typeof l)throw Error("serializer must be a function");if("function"!=typeof d)throw Error("deserializer must be a function");if("function"!=typeof h)throw Error("patchStrategy must be one of the included patching strategies or a custom patching function");this.portName=o,this.readyResolved=!1,this.readyPromise=new Promise((function(e){return t.readyResolve=e})),this.browserAPI=H(),this.extensionId=u,this.port=this.browserAPI.runtime.connect(this.extensionId,{name:o}),this.safetyHandler=this.safetyHandler.bind(this),this.browserAPI.runtime.onMessage&&(this.safetyMessage=this.browserAPI.runtime.onMessage.addListener(this.safetyHandler)),this.serializedPortListener=I(d)((function(){var e;return(e=t.port.onMessage).addListener.apply(e,arguments)})),this.serializedMessageSender=L(l)((function(){var e;return(e=t.browserAPI.runtime).sendMessage.apply(e,arguments)}),1),this.listeners=[],this.state=a,this.patchStrategy=h,this.serializedPortListener((function(e){switch(e.type){case k:t.replaceState(e.payload),t.readyResolved||(t.readyResolved=!0,t.readyResolve());break;case z:t.patchState(e.payload)}})),this.dispatch=this.dispatch.bind(this)}var r,n,o;return r=e,(n=[{key:"ready",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return null!==e?this.readyPromise.then(e):this.readyPromise}},{key:"subscribe",value:function(e){var t=this;return this.listeners.push(e),function(){t.listeners=t.listeners.filter((function(t){return t!==e}))}}},{key:"patchState",value:function(e){this.state=this.patchStrategy(this.state,e),this.listeners.forEach((function(e){return e()}))}},{key:"replaceState",value:function(e){this.state=e,this.listeners.forEach((function(e){return e()}))}},{key:"getState",value:function(){return this.state}},{key:"replaceReducer",value:function(){}},{key:"dispatch",value:function(e){var t=this;return new Promise((function(r,n){t.serializedMessageSender(t.extensionId,{type:"chromex.dispatch",portName:t.portName,payload:e},null,(function(e){var t=e.error,o=e.value;if(t){var i=Error("".concat("\nLooks like there is an error in the background page. You might want to inspect your background page for more details.\n").concat(t));n(O(i,t))}else r(o&&o.payload)}))}))}},{key:"safetyHandler",value:function(e){"storeReady"===e.action&&e.portName===this.portName&&(this.browserAPI.runtime.onMessage.removeListener(this.safetyHandler),this.readyResolved||(this.readyResolved=!0,this.readyResolve()))}}])&&t(r.prototype,n),o&&t(r,o),e}(),e.alias=function(e){return function(){return function(t){return function(r){var n=e[r.type];return t(n?n(r):r)}}}},e.applyMiddleware=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;t>n;n++)r[n-1]=arguments[n];var i=function(){throw Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},a={getState:e.getState.bind(e),dispatch:function(){return i.apply(void 0,arguments)}};return r=(r||[]).map((function(e){return e(a)})),i=D.apply(void 0,o(r))(e.dispatch),e.dispatch=i,e},e.wrapStore=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:F,r=t.portName,n=void 0===r?F.portName:r,o=t.dispatchResponder,i=void 0===o?F.dispatchResponder:o,a=t.serializer,s=void 0===a?F.serializer:a,u=t.deserializer,c=void 0===u?F.deserializer:u,l=t.diffStrategy,f=void 0===l?F.diffStrategy:l;if(!n)throw Error("portName is required in options");if("function"!=typeof s)throw Error("serializer must be a function");if("function"!=typeof c)throw Error("deserializer must be a function");if("function"!=typeof f)throw Error("diffStrategy must be one of the included diffing strategies or a custom diff function");var d=H(),p=function(t,r,o){if("chromex.dispatch"===t.type&&t.portName===n){var a=Object.assign({},t.payload,{_sender:r}),s=null;try{s=e.dispatch(a)}catch(e){s=Promise.reject(e.message),console.error(e)}return i(s,o),!0}},h=function(t){if(t.name===n){var r=L(s)((function(){return t.postMessage.apply(t,arguments)})),o=e.getState(),i=e.subscribe((function(){var t=e.getState(),n=f(o,t);n.length&&(o=t,r({type:z,payload:n}))}));t.onDisconnect.addListener(i),r({type:k,payload:o})}},y=I(c),v=function(e){return"chromex.dispatch"===e.type&&e.portName===n};y((function(){var e;return(e=d.runtime.onMessage).addListener.apply(e,arguments)}))(p,v),d.runtime.onMessageExternal?y((function(){var e;return(e=d.runtime.onMessageExternal).addListener.apply(e,arguments)}))(p,v):console.warn("runtime.onMessageExternal is not supported"),d.runtime.onConnect.addListener(h),d.runtime.onConnectExternal?d.runtime.onConnectExternal.addListener(h):console.warn("runtime.onConnectExternal is not supported"),d.tabs.query({},(function(e){var t=!0,r=!1,o=void 0;try{for(var i,a=e[Symbol.iterator]();!(t=(i=a.next()).done);t=!0){d.tabs.sendMessage(i.value.id,{action:"storeReady",portName:n},(function(){chrome}))}}catch(e){r=!0,o=e}finally{try{t||null==a.return||a.return()}finally{if(r)throw o}}}))},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).WebextRedux={})}(this,(function(e){"use strict";function t(e,t){for(var r=0;t.length>r;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function r(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e){for(var t=1;arguments.length>t;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){r(e,t,n[t])}))}return e}function o(e){return function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);e.length>t;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var i=9007199254740991,a="[object Arguments]",s="[object Function]",u="[object GeneratorFunction]",c=/^(?:0|[1-9]\d*)$/;function l(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var f=Object.prototype,d=f.hasOwnProperty,p=f.toString,h=f.propertyIsEnumerable,y=Math.max;function v(e,t){var r=P(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&j(e)}(e)&&d.call(e,"callee")&&(!h.call(e,"callee")||p.call(e)==a)}(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],n=r.length,o=!!n;for(var i in e)!t&&!d.call(e,i)||o&&("length"==i||b(i,n))||r.push(i);return r}function g(e,t,r){var n=e[t];d.call(e,t)&&w(n,r)&&(void 0!==r||t in e)||(e[t]=r)}function m(e){if(!A(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t,r,n=(t=e)===("function"==typeof(r=t&&t.constructor)&&r.prototype||f),o=[];for(var i in e)("constructor"!=i||!n&&d.call(e,i))&&o.push(i);return o}function b(e,t){return!!(t=null==t?i:t)&&("number"==typeof e||c.test(e))&&e>-1&&e%1==0&&t>e}function w(e,t){return e===t||e!=e&&t!=t}var E,S,x,P=Array.isArray;function j(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&i>=e}(e.length)&&!function(e){var t=A(e)?p.call(e):"";return t==s||t==u}(e)}function A(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}var O=(E=function(e,t){!function(e,t,r,n){r||(r={});for(var o=-1,i=t.length;++o<i;){var a=t[o],s=n?n(r[a],e[a],a,r,e):void 0;g(r,a,void 0===s?e[a]:s)}}(t,function(e){return j(e)?v(e,!0):m(e)}(t),e)},S=function(e,t){var r=-1,n=t.length,o=n>1?t[n-1]:void 0,i=n>2?t[2]:void 0;for(o=E.length>3&&"function"==typeof o?(n--,o):void 0,i&&function(e,t,r){if(!A(r))return!1;var n=typeof t;return!!("number"==n?j(r)&&b(t,r.length):"string"==n&&t in r)&&w(r[t],e)}(t[0],t[1],i)&&(o=3>n?void 0:o,n=1),e=Object(e);++r<n;){var a=t[r];a&&E(e,a,r,o)}return e},x=y(void 0===x?S.length-1:x,0),function(){for(var e=arguments,t=-1,r=y(e.length-x,0),n=Array(r);++t<r;)n[t]=e[x+t];t=-1;for(var o=Array(x+1);++t<x;)o[t]=e[t];return o[x]=n,l(S,this,o)}),k="chromex.state",z="chromex.patch_state",M=function(e){return e},I=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:M;return n({},e,e.payload?{payload:t(e.payload)}:{})},N=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:M,r=arguments.length>2?arguments[2]:void 0;return r?function(n){for(var o=arguments.length,i=Array(o>1?o-1:0),a=1;o>a;a++)i[a-1]=arguments[a];return r.apply(void 0,[n].concat(i))?e.apply(void 0,[I(n,t)].concat(i)):e.apply(void 0,[n].concat(i))}:function(r){for(var n=arguments.length,o=Array(n>1?n-1:0),i=1;n>i;i++)o[i-1]=arguments[i];return e.apply(void 0,[I(r,t)].concat(o))}},R=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:M;return function(t){return function(r,n){return t(N(r,e,n))}}},L=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:M;return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return function(){for(var n=arguments.length,o=Array(n),i=0;n>i;i++)o[i]=arguments[i];if(r>=o.length)throw Error("Message in request could not be serialized. "+"Expected message in position ".concat(r," but only received ").concat(o.length," args."));return o[r]=I(o[r],e),t.apply(void 0,o)}}},_="updated",C="removed";function H(){var e;try{e=self.chrome||self.browser||browser}catch(t){e=browser}if(!e)throw Error("Browser API is not present");return e}var q="\nLooks like there is an error in the background page. You might want to inspect your background page for more details.\n",D={portName:"chromex.port_name",state:{},extensionId:null,serializer:M,deserializer:M,patchStrategy:function(e,t){var r=Object.assign({},e);return t.forEach((function(e){var t=e.key,n=e.value;switch(e.change){case _:r[t]=n;break;case C:Reflect.deleteProperty(r,t)}})),r}};function F(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}var T={portName:"chromex.port_name",dispatchResponder:function(e,t){Promise.resolve(e).then((function(e){t({error:null,value:e})})).catch((function(e){console.error("error dispatching result:",e),t({error:e.message,value:null})}))},serializer:M,deserializer:M,diffStrategy:function(e,t){var r=[];return Object.keys(t).forEach((function(n){e[n]!==t[n]&&r.push({key:n,value:t[n],change:_})})),Object.keys(e).forEach((function(e){t.hasOwnProperty(e)||r.push({key:e,change:C})})),r}};e.Store=function(){function e(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:D,n=r.portName,o=void 0===n?D.portName:n,i=r.state,a=void 0===i?D.state:i,s=r.extensionId,u=void 0===s?D.extensionId:s,c=r.serializer,l=void 0===c?D.serializer:c,f=r.deserializer,d=void 0===f?D.deserializer:f,p=r.patchStrategy,h=void 0===p?D.patchStrategy:p;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!o)throw Error("portName is required in options");if("function"!=typeof l)throw Error("serializer must be a function");if("function"!=typeof d)throw Error("deserializer must be a function");if("function"!=typeof h)throw Error("patchStrategy must be one of the included patching strategies or a custom patching function");this.portName=o,this.readyResolved=!1,this.readyPromise=new Promise((function(e){return t.readyResolve=e})),this.browserAPI=H(),this.extensionId=u,this.port=this.browserAPI.runtime.connect(this.extensionId,{name:o}),this.safetyHandler=this.safetyHandler.bind(this),this.browserAPI.runtime.onMessage&&(this.safetyMessage=this.browserAPI.runtime.onMessage.addListener(this.safetyHandler)),this.serializedPortListener=R(d)((function(){var e;return(e=t.port.onMessage).addListener.apply(e,arguments)})),this.serializedMessageSender=L(l)((function(){var e;return(e=t.browserAPI.runtime).sendMessage.apply(e,arguments)}),1),this.listeners=[],this.state=a,this.patchStrategy=h,this.serializedPortListener((function(e){switch(e.type){case k:t.replaceState(e.payload),t.readyResolved||(t.readyResolved=!0,t.readyResolve());break;case z:t.patchState(e.payload)}})),this.dispatch=this.dispatch.bind(this)}var r,n,o;return r=e,(n=[{key:"ready",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return null!==e?this.readyPromise.then(e):this.readyPromise}},{key:"subscribe",value:function(e){var t=this;return this.listeners.push(e),function(){t.listeners=t.listeners.filter((function(t){return t!==e}))}}},{key:"patchState",value:function(e){this.state=this.patchStrategy(this.state,e),this.listeners.forEach((function(e){return e()}))}},{key:"replaceState",value:function(e){this.state=e,this.listeners.forEach((function(e){return e()}))}},{key:"getState",value:function(){return this.state}},{key:"replaceReducer",value:function(){}},{key:"dispatch",value:function(e){var t=this;return new Promise((function(r,n){t.serializedMessageSender(t.extensionId,{type:"chromex.dispatch",portName:t.portName,payload:e},null,(function(e){if(e){var o=e.error,i=e.value;if(o){var a=Error("".concat(q).concat(o));n(O(a,o))}else r(i&&i.payload)}else{var s=t.browserAPI.runtime.lastError,u=Error("".concat(q).concat(s));n(O(u,s))}}))}))}},{key:"safetyHandler",value:function(e){"storeReady"===e.action&&e.portName===this.portName&&(this.browserAPI.runtime.onMessage.removeListener(this.safetyHandler),this.readyResolved||(this.readyResolved=!0,this.readyResolve()))}}])&&t(r.prototype,n),o&&t(r,o),e}(),e.alias=function(e){return function(){return function(t){return function(r){var n=e[r.type];return t(n?n(r):r)}}}},e.applyMiddleware=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;t>n;n++)r[n-1]=arguments[n];var i=function(){throw Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},a={getState:e.getState.bind(e),dispatch:function(){return i.apply(void 0,arguments)}};return r=(r||[]).map((function(e){return e(a)})),i=F.apply(void 0,o(r))(e.dispatch),e.dispatch=i,e},e.wrapStore=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:T,r=t.portName,n=void 0===r?T.portName:r,o=t.dispatchResponder,i=void 0===o?T.dispatchResponder:o,a=t.serializer,s=void 0===a?T.serializer:a,u=t.deserializer,c=void 0===u?T.deserializer:u,l=t.diffStrategy,f=void 0===l?T.diffStrategy:l;if(!n)throw Error("portName is required in options");if("function"!=typeof s)throw Error("serializer must be a function");if("function"!=typeof c)throw Error("deserializer must be a function");if("function"!=typeof f)throw Error("diffStrategy must be one of the included diffing strategies or a custom diff function");var d=H(),p=function(t,r,o){if("chromex.dispatch"===t.type&&t.portName===n){var a=Object.assign({},t.payload,{_sender:r}),s=null;try{s=e.dispatch(a)}catch(e){s=Promise.reject(e.message),console.error(e)}return i(s,o),!0}},h=function(t){if(t.name===n){var r=L(s)((function(){return t.postMessage.apply(t,arguments)})),o=e.getState(),i=e.subscribe((function(){var t=e.getState(),n=f(o,t);n.length&&(o=t,r({type:z,payload:n}))}));t.onDisconnect.addListener(i),r({type:k,payload:o})}},y=R(c),v=function(e){return"chromex.dispatch"===e.type&&e.portName===n};y((function(){var e;return(e=d.runtime.onMessage).addListener.apply(e,arguments)}))(p,v),d.runtime.onMessageExternal?y((function(){var e;return(e=d.runtime.onMessageExternal).addListener.apply(e,arguments)}))(p,v):console.warn("runtime.onMessageExternal is not supported"),d.runtime.onConnect.addListener(h),d.runtime.onConnectExternal?d.runtime.onConnectExternal.addListener(h):console.warn("runtime.onConnectExternal is not supported"),d.tabs.query({},(function(e){var t=!0,r=!1,o=void 0;try{for(var i,a=e[Symbol.iterator]();!(t=(i=a.next()).done);t=!0){d.tabs.sendMessage(i.value.id,{action:"storeReady",portName:n},(function(){chrome}))}}catch(e){r=!0,o=e}finally{try{t||null==a.return||a.return()}finally{if(r)throw o}}}))},Object.defineProperty(e,"__esModule",{value:!0})})); |
@@ -231,2 +231,9 @@ "use strict"; | ||
}, null, function (resp) { | ||
if (!resp) { | ||
var _error = _this3.browserAPI.runtime.lastError; | ||
var bgErr = new Error("".concat(backgroundErrPrefix).concat(_error)); | ||
reject((0, _lodash.default)(bgErr, _error)); | ||
return; | ||
} | ||
var error = resp.error, | ||
@@ -236,4 +243,5 @@ value = resp.value; | ||
if (error) { | ||
var bgErr = new Error("".concat(backgroundErrPrefix).concat(error)); | ||
reject((0, _lodash.default)(bgErr, error)); | ||
var _bgErr = new Error("".concat(backgroundErrPrefix).concat(error)); | ||
reject((0, _lodash.default)(_bgErr, error)); | ||
} else { | ||
@@ -240,0 +248,0 @@ resolve(value && value.payload); |
{ | ||
"name": "webext-redux", | ||
"version": "2.1.7", | ||
"version": "2.1.8", | ||
"description": "A set of utilities for building Redux applications in Web Extensions.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -452,2 +452,4 @@ # WebExt Redux | ||
[![Storyful][storyful-image]][storyful-url] | ||
Using `webext-redux` in your project? We'd love to hear about it! Just [open an issue](https://github.com/tshaddix/webext-redux/issues) and let us know. | ||
@@ -467,1 +469,3 @@ | ||
[mabl-url]: https://www.mabl.com | ||
[storyful-image]: https://user-images.githubusercontent.com/702227/140521240-be12e5ba-4f4e-4593-80a0-352f1acfe039.jpeg | ||
[storyful-url]: https://storyful.com |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
138771
2854
470