Socket
Socket
Sign inDemoInstall

reduxed-chrome-storage

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

reduxed-chrome-storage - npm Package Compare versions

Comparing version 3.0.0 to 3.0.5

13

dist/index.esm.js
/**
* @license
* ReduxedChromeStorage v3.0.0
* ReduxedChromeStorage v3.0.5
* https://github.com/hindmost/reduxed-chrome-storage

@@ -201,3 +201,3 @@ * Copyright (c) Savr Goryaev aka hindmost

this.storage.load(data => {
const [storedState, id, timestamp] = unpackState(data);
const [storedState, , timestamp] = unpackState(data);
let newState = storedState ?

@@ -230,4 +230,5 @@ mergeOrReplace(defaultState, storedState) : defaultState;

const store = this.store = this._instantiateStore(this.state);
const timestamp = Date.now();
this.outdted.map(([t, u]) => t ? [t, u] : [timestamp, u]);
const now = Date.now();
const n = this.outdted.length;
this.outdted = this.outdted.map(([t, u], i) => t || i >= n - 1 ? [t, u] : [now, u]);
let state0 = cloneDeep(this.state);

@@ -263,5 +264,5 @@ const unsubscribe = this.store.subscribe(() => {

const now = Date.now();
const nOld = this.outdted.length;
const n = this.outdted.length;
this.outdted.forEach(([timestamp, unsubscribe], i) => {
if (i >= nOld - 1 || now - timestamp < this.timeout)
if (i >= n - 1 || now - timestamp < this.timeout)
return;

@@ -268,0 +269,0 @@ unsubscribe();

/**
* @license
* ReduxedChromeStorage v3.0.0
* ReduxedChromeStorage v3.0.5
* https://github.com/hindmost/reduxed-chrome-storage

@@ -217,3 +217,2 @@ * Copyright (c) Savr Goryaev aka hindmost

var storedState = ref[0];
ref[1];
var timestamp = ref[2];

@@ -249,8 +248,9 @@ var newState = storedState ?

var store = this.store = this._instantiateStore(this.state);
var timestamp = Date.now();
this.outdted.map(function (ref) {
var now = Date.now();
var n = this.outdted.length;
this.outdted = this.outdted.map(function (ref, i) {
var t = ref[0];
var u = ref[1];
return t ? [t, u] : [timestamp, u];
return t || i >= n - 1 ? [t, u] : [now, u];
});

@@ -289,3 +289,3 @@ var state0 = cloneDeep(this.state);

var now = Date.now();
var nOld = this.outdted.length;
var n = this.outdted.length;
this.outdted.forEach(function (ref, i) {

@@ -295,3 +295,3 @@ var timestamp = ref[0];

if (i >= nOld - 1 || now - timestamp < this$1$1.timeout)
if (i >= n - 1 || now - timestamp < this$1$1.timeout)
{ return; }

@@ -298,0 +298,0 @@ unsubscribe();

/**
* @license
* ReduxedChromeStorage v3.0.0
* ReduxedChromeStorage v3.0.5
* https://github.com/hindmost/reduxed-chrome-storage

@@ -15,2 +15,2 @@ * Copyright (c) Savr Goryaev aka hindmost

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).reduxedChromeStorage={})}(this,(function(t){"use strict";var e,r=new Uint8Array(16);function n(){if(!e&&!(e="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return e(r)}var i=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function o(t){return"string"==typeof t&&i.test(t)}for(var s=[],a=0;256>a;++a)s.push((a+256).toString(16).substr(1));function u(t,e,r){var i=(t=t||{}).random||(t.rng||n)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,e){r=r||0;for(var a=0;16>a;++a)e[r+a]=i[a];return e}return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(s[t[e+0]]+s[t[e+1]]+s[t[e+2]]+s[t[e+3]]+"-"+s[t[e+4]]+s[t[e+5]]+"-"+s[t[e+6]]+s[t[e+7]]+"-"+s[t[e+8]]+s[t[e+9]]+"-"+s[t[e+10]]+s[t[e+11]]+s[t[e+12]]+s[t[e+13]]+s[t[e+14]]+s[t[e+15]]).toLowerCase();if(!o(r))throw TypeError("Stringified UUID is invalid");return r}(i)}function c(t){return null==t||"object"!=typeof t?t:JSON.parse(JSON.stringify(t))}function f(t,e){if(t===e)return!0;if(null==t||"object"!=typeof t||null==e||"object"!=typeof e||Array.isArray(t)!==Array.isArray(e))return!1;var r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(var i=0,o=r;o.length>i;i+=1){var s=o[i];if(-1>=n.indexOf(s)||!f(t[s],e[s]))return!1}return!0}function h(t,e){if(t!==e){if(null==t||"object"!=typeof t||null==e||"object"!=typeof e)return t;if(Array.isArray(t)||Array.isArray(e))return f(t,e)?void 0:t;var r=Object.keys(e),n=!0,i=Object.keys(t).reduce((function(i,o){var s=r.indexOf(o)>-1?h(t[o],e[o]):t[o];return void 0===s||(n=!1,i[o]=s),i}),{});return n?void 0:i}}function p(t,e){return Array.isArray(e)?c(e):null==t||"object"!=typeof t||Array.isArray(t)||null==e||"object"!=typeof e?void 0!==e?e:t:Object.keys(t).concat(Object.keys(e).filter((function(e){return!(e in t)}))).reduce((function(r,n){return r[n]=p(t[n],e[n]),r}),{})}var l,y=function(t){if(void 0===t||!Array.isArray(t)||3!==t.length)return[t,"",0];var e=t[0],r=t[1];return"string"==typeof e&&"number"==typeof r?[t[2],e,r]:[t,"",0]},d=function(t,e,r,n,i,o,s){this.container=t,this.storage=e,this.isolated=r,this.plain=n,this.timeout=i?Math.max(i,500):1e3,this.resetState=s,this.store=this._instantiateStore(),this.state=null,this.id=u(),this.tmstamp=0,this.outdted=[],"function"==typeof o&&(this.lisner=o),this.lisners=[],this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.dispatch=this.dispatch.bind(this),this.replaceReducer=this.replaceReducer.bind(this),this[Symbol.observable]=this[Symbol.observable].bind(this)};d.prototype.init=function(){var t=this;this.tmstamp||this.isolated||this.storage.subscribe((function(e,r){var n=y(e),i=n[0],o=n[2];if(n[1]!==t.id&&!f(i,t.state)){var s=o>=t.tmstamp,a=s?p(t.state,i):p(i,t.state);!s&&f(a,t.state)||(t._setState(a,o),t._renewStore()),s&&f(a,i)||t._send2Storage(),t._callListeners()}}));var e=this.store.getState();return new Promise((function(r){t.storage.load((function(n){var i=y(n),o=i[0],s=i[2],a=o?p(e,o):e;t.resetState&&(a=p(a,t.resetState)),t._setState(a,s),t._renewStore(),f(a,o)||t._send2Storage(),r(t)}))}))},d.prototype.initFrom=function(t){return this._setState(t,0),this._renewStore(),this},d.prototype._setState=function(t,e){this.state=c(t),(e=void 0!==e?e:Date.now())>this.tmstamp&&(this.tmstamp=e)},d.prototype._renewStore=function(){var t=this;this.plain?this.unsub&&this.unsub():this._clean();var e=this.store=this._instantiateStore(this.state),r=Date.now();this.outdted.map((function(t){var e=t[0],n=t[1];return e?[e,n]:[r,n]}));var n=c(this.state),i=this.store.subscribe((function(){var r=e&&e.getState(),i=t.store===e;if(t._clean(),!f(r,t.state)){if(i)t._setState(r);else{var o=h(r,n);if(void 0===o)return;t._setState(p(t.state,o)),t._renewStore()}t._send2Storage(),t._callListeners(!0,n),n=c(r)}}));this.plain?this.unsub=i:this.outdted.push([0,i])},d.prototype._clean=function(){var t=this;if(!this.plain){var e=Date.now(),r=this.outdted.length;this.outdted.forEach((function(n,i){r-1>i&&e-n[0]>=t.timeout&&((0,n[1])(),delete t.outdted[i])}))}},d.prototype._instantiateStore=function(t){var e=this.container(t);if("object"!=typeof e||"function"!=typeof e.getState)throw Error("Invalid 'storeCreatorContainer' supplied");return e},d.prototype._send2Storage=function(){this.storage.save([this.id,this.tmstamp,this.state])},d.prototype._callListeners=function(t,e){t&&this.lisner&&this.lisner(this,e);for(var r=0,n=this.lisners;n.length>r;r+=1){(0,n[r])()}},d.prototype.getState=function(){return this.state},d.prototype.subscribe=function(t){var e=this;return"function"==typeof t&&this.lisners.push(t),function(){"function"==typeof t&&(e.lisners=e.lisners.filter((function(e){return e!==t})))}},d.prototype.dispatch=function(t){return this.store.dispatch(t)},d.prototype.replaceReducer=function(t){return"function"==typeof t&&this.store.replaceReducer(t),this},d.prototype[Symbol.observable]=function(){var t,e=this.getState,r=this.subscribe;return(t={subscribe:function(t){if("object"!=typeof t||null===t)throw new TypeError("Expected the observer to be an object.");function n(){t.next&&t.next(e())}return n(),{unsubscribe:r(n)}}})[Symbol.observable]=function(){return this},t},function(t){t.local="local",t.sync="sync"}(l||(l={}));var b=function(t){return(new TextEncoder).encode(Object.entries(t).map((function(t){return t[0]+JSON.stringify(t[1])})).join("")).length},v=function(t){var e=t.area,r=t.key;this.ns=t.namespace,this.areaName=e===l.sync?l.sync:l.local,this.key=r||"reduxed",this.listeners=[],this.errListeners=[]};v.prototype.regShared=function(){var t=this;this.regListener((function(e,r){for(var n=0,i=t.listeners;i.length>n;n+=1){(0,i[n])(e,r)}}))},v.prototype.regListener=function(t){var e=this;this.ns.storage.onChanged.addListener((function(r,n){if(n===e.areaName&&e.key in r){var i=r[e.key],o=i.newValue;o&&t(o,i.oldValue)}}))},v.prototype.subscribe=function(t){"function"==typeof t&&this.listeners.push(t)},v.prototype.subscribeForError=function(t){"function"==typeof t&&this.errListeners.push(t)},v.prototype.fireErrorListeners=function(t,e){for(var r=0,n=this.errListeners;n.length>r;r+=1){(0,n[r])(t,e)}},v.prototype.callbackOnLoad=function(t,e,r){e(!this.ns.runtime.lastError&&(r?t:t&&t[this.key]))},v.prototype.callbackOnSave=function(t,e){var r,n=this;if(this.ns.runtime.lastError){var i=this.ns.runtime.lastError.message;if(i&&t&&e)this.areaName===l.sync&&e.QUOTA_BYTES_PER_ITEM&&b(((r={})[this.key]=t,r))>e.QUOTA_BYTES_PER_ITEM?this.fireErrorListeners(i,!0):this.load((function(r){var o,s="object"==typeof r&&e.QUOTA_BYTES>0&&b(Object.assign(Object.assign({},r),((o={})[n.key]=t,o)))>e.QUOTA_BYTES;n.fireErrorListeners(i,s)}),!0);else this.fireErrorListeners(i||"",!1)}};var m,g=function(t){function e(e){t.call(this,{namespace:e.namespace,area:e.area,key:e.key}),this.areaApi=this.ns.storage[this.areaName]}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.load=function(t,e){var r=this;"function"==typeof t&&this.areaApi.get(e?null:this.key,(function(n){r.callbackOnLoad(n,t,e)}))},e.prototype.save=function(t){var e,r=this;this.areaApi.set(((e={})[this.key]=t,e),(function(){r.callbackOnSave(t,r.areaApi)}))},e}(v),S=function(t){function e(e){t.call(this,{namespace:e.namespace,area:e.area,key:e.key}),this.areaApi=this.ns.storage[this.areaName]}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.load=function(t,e){var r=this;"function"==typeof t&&this.areaApi.get(e?null:this.key).then((function(e){r.callbackOnLoad(e,t)}))},e.prototype.save=function(t){var e,r=this;this.areaApi.set((e={},e[this.key]=t,e)).then((function(){r.callbackOnSave(t,r.areaApi)}))},e}(v);!function(t){t.chrome="chrome",t.browser="browser"}(m||(m={})),t.cloneDeep=c,t.diffDeep=h,t.isEqual=f,t.mergeOrReplace=p,t.setupReduxed=function(t,e,r){var n=e||{},i=n.namespace,o=n.chromeNs,s=n.browserNs,a=n.storageArea,u=n.storageKey,c=n.isolated,f=n.plainActions,h=n.outdatedTimeout,p=r||{},l=p.onGlobalChange,b=p.onLocalChange,v=p.onError;if("function"!=typeof t)throw Error("Missing argument for 'storeCreatorContainer'");var _=s||i===m.browser?new S({namespace:s||browser,area:a,key:u}):new g({namespace:o||chrome,area:a,key:u});return"function"==typeof l&&_.regListener((function(e,r){var n=new d(t,_,!0,f),i=y(e)[0],o=y(r)[0];l(n.initFrom(i),o)})),c||_.regShared(),function(e){return v&&_.subscribeForError(v),new d(t,_,c,f,h,b,e).init()}},Object.defineProperty(t,"__esModule",{value:!0})}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).reduxedChromeStorage={})}(this,(function(t){"use strict";var e,r=new Uint8Array(16);function n(){if(!e&&!(e="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return e(r)}var i=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function o(t){return"string"==typeof t&&i.test(t)}for(var s=[],a=0;256>a;++a)s.push((a+256).toString(16).substr(1));function u(t,e,r){var i=(t=t||{}).random||(t.rng||n)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,e){r=r||0;for(var a=0;16>a;++a)e[r+a]=i[a];return e}return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(s[t[e+0]]+s[t[e+1]]+s[t[e+2]]+s[t[e+3]]+"-"+s[t[e+4]]+s[t[e+5]]+"-"+s[t[e+6]]+s[t[e+7]]+"-"+s[t[e+8]]+s[t[e+9]]+"-"+s[t[e+10]]+s[t[e+11]]+s[t[e+12]]+s[t[e+13]]+s[t[e+14]]+s[t[e+15]]).toLowerCase();if(!o(r))throw TypeError("Stringified UUID is invalid");return r}(i)}function c(t){return null==t||"object"!=typeof t?t:JSON.parse(JSON.stringify(t))}function f(t,e){if(t===e)return!0;if(null==t||"object"!=typeof t||null==e||"object"!=typeof e||Array.isArray(t)!==Array.isArray(e))return!1;var r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(var i=0,o=r;o.length>i;i+=1){var s=o[i];if(-1>=n.indexOf(s)||!f(t[s],e[s]))return!1}return!0}function h(t,e){if(t!==e){if(null==t||"object"!=typeof t||null==e||"object"!=typeof e)return t;if(Array.isArray(t)||Array.isArray(e))return f(t,e)?void 0:t;var r=Object.keys(e),n=!0,i=Object.keys(t).reduce((function(i,o){var s=r.indexOf(o)>-1?h(t[o],e[o]):t[o];return void 0===s||(n=!1,i[o]=s),i}),{});return n?void 0:i}}function p(t,e){return Array.isArray(e)?c(e):null==t||"object"!=typeof t||Array.isArray(t)||null==e||"object"!=typeof e?void 0!==e?e:t:Object.keys(t).concat(Object.keys(e).filter((function(e){return!(e in t)}))).reduce((function(r,n){return r[n]=p(t[n],e[n]),r}),{})}var l,y=function(t){if(void 0===t||!Array.isArray(t)||3!==t.length)return[t,"",0];var e=t[0],r=t[1];return"string"==typeof e&&"number"==typeof r?[t[2],e,r]:[t,"",0]},d=function(t,e,r,n,i,o,s){this.container=t,this.storage=e,this.isolated=r,this.plain=n,this.timeout=i?Math.max(i,500):1e3,this.resetState=s,this.store=this._instantiateStore(),this.state=null,this.id=u(),this.tmstamp=0,this.outdted=[],"function"==typeof o&&(this.lisner=o),this.lisners=[],this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.dispatch=this.dispatch.bind(this),this.replaceReducer=this.replaceReducer.bind(this),this[Symbol.observable]=this[Symbol.observable].bind(this)};d.prototype.init=function(){var t=this;this.tmstamp||this.isolated||this.storage.subscribe((function(e,r){var n=y(e),i=n[0],o=n[2];if(n[1]!==t.id&&!f(i,t.state)){var s=o>=t.tmstamp,a=s?p(t.state,i):p(i,t.state);!s&&f(a,t.state)||(t._setState(a,o),t._renewStore()),s&&f(a,i)||t._send2Storage(),t._callListeners()}}));var e=this.store.getState();return new Promise((function(r){t.storage.load((function(n){var i=y(n),o=i[0],s=i[2],a=o?p(e,o):e;t.resetState&&(a=p(a,t.resetState)),t._setState(a,s),t._renewStore(),f(a,o)||t._send2Storage(),r(t)}))}))},d.prototype.initFrom=function(t){return this._setState(t,0),this._renewStore(),this},d.prototype._setState=function(t,e){this.state=c(t),(e=void 0!==e?e:Date.now())>this.tmstamp&&(this.tmstamp=e)},d.prototype._renewStore=function(){var t=this;this.plain?this.unsub&&this.unsub():this._clean();var e=this.store=this._instantiateStore(this.state),r=Date.now(),n=this.outdted.length;this.outdted=this.outdted.map((function(t,e){var i=t[0],o=t[1];return i||e>=n-1?[i,o]:[r,o]}));var i=c(this.state),o=this.store.subscribe((function(){var r=e&&e.getState(),n=t.store===e;if(t._clean(),!f(r,t.state)){if(n)t._setState(r);else{var o=h(r,i);if(void 0===o)return;t._setState(p(t.state,o)),t._renewStore()}t._send2Storage(),t._callListeners(!0,i),i=c(r)}}));this.plain?this.unsub=o:this.outdted.push([0,o])},d.prototype._clean=function(){var t=this;if(!this.plain){var e=Date.now(),r=this.outdted.length;this.outdted.forEach((function(n,i){r-1>i&&e-n[0]>=t.timeout&&((0,n[1])(),delete t.outdted[i])}))}},d.prototype._instantiateStore=function(t){var e=this.container(t);if("object"!=typeof e||"function"!=typeof e.getState)throw Error("Invalid 'storeCreatorContainer' supplied");return e},d.prototype._send2Storage=function(){this.storage.save([this.id,this.tmstamp,this.state])},d.prototype._callListeners=function(t,e){t&&this.lisner&&this.lisner(this,e);for(var r=0,n=this.lisners;n.length>r;r+=1){(0,n[r])()}},d.prototype.getState=function(){return this.state},d.prototype.subscribe=function(t){var e=this;return"function"==typeof t&&this.lisners.push(t),function(){"function"==typeof t&&(e.lisners=e.lisners.filter((function(e){return e!==t})))}},d.prototype.dispatch=function(t){return this.store.dispatch(t)},d.prototype.replaceReducer=function(t){return"function"==typeof t&&this.store.replaceReducer(t),this},d.prototype[Symbol.observable]=function(){var t,e=this.getState,r=this.subscribe;return(t={subscribe:function(t){if("object"!=typeof t||null===t)throw new TypeError("Expected the observer to be an object.");function n(){t.next&&t.next(e())}return n(),{unsubscribe:r(n)}}})[Symbol.observable]=function(){return this},t},function(t){t.local="local",t.sync="sync"}(l||(l={}));var b=function(t){return(new TextEncoder).encode(Object.entries(t).map((function(t){return t[0]+JSON.stringify(t[1])})).join("")).length},v=function(t){var e=t.area,r=t.key;this.ns=t.namespace,this.areaName=e===l.sync?l.sync:l.local,this.key=r||"reduxed",this.listeners=[],this.errListeners=[]};v.prototype.regShared=function(){var t=this;this.regListener((function(e,r){for(var n=0,i=t.listeners;i.length>n;n+=1){(0,i[n])(e,r)}}))},v.prototype.regListener=function(t){var e=this;this.ns.storage.onChanged.addListener((function(r,n){if(n===e.areaName&&e.key in r){var i=r[e.key],o=i.newValue;o&&t(o,i.oldValue)}}))},v.prototype.subscribe=function(t){"function"==typeof t&&this.listeners.push(t)},v.prototype.subscribeForError=function(t){"function"==typeof t&&this.errListeners.push(t)},v.prototype.fireErrorListeners=function(t,e){for(var r=0,n=this.errListeners;n.length>r;r+=1){(0,n[r])(t,e)}},v.prototype.callbackOnLoad=function(t,e,r){e(!this.ns.runtime.lastError&&(r?t:t&&t[this.key]))},v.prototype.callbackOnSave=function(t,e){var r,n=this;if(this.ns.runtime.lastError){var i=this.ns.runtime.lastError.message;if(i&&t&&e)this.areaName===l.sync&&e.QUOTA_BYTES_PER_ITEM&&b(((r={})[this.key]=t,r))>e.QUOTA_BYTES_PER_ITEM?this.fireErrorListeners(i,!0):this.load((function(r){var o,s="object"==typeof r&&e.QUOTA_BYTES>0&&b(Object.assign(Object.assign({},r),((o={})[n.key]=t,o)))>e.QUOTA_BYTES;n.fireErrorListeners(i,s)}),!0);else this.fireErrorListeners(i||"",!1)}};var g,m=function(t){function e(e){t.call(this,{namespace:e.namespace,area:e.area,key:e.key}),this.areaApi=this.ns.storage[this.areaName]}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.load=function(t,e){var r=this;"function"==typeof t&&this.areaApi.get(e?null:this.key,(function(n){r.callbackOnLoad(n,t,e)}))},e.prototype.save=function(t){var e,r=this;this.areaApi.set(((e={})[this.key]=t,e),(function(){r.callbackOnSave(t,r.areaApi)}))},e}(v),S=function(t){function e(e){t.call(this,{namespace:e.namespace,area:e.area,key:e.key}),this.areaApi=this.ns.storage[this.areaName]}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.load=function(t,e){var r=this;"function"==typeof t&&this.areaApi.get(e?null:this.key).then((function(e){r.callbackOnLoad(e,t)}))},e.prototype.save=function(t){var e,r=this;this.areaApi.set((e={},e[this.key]=t,e)).then((function(){r.callbackOnSave(t,r.areaApi)}))},e}(v);!function(t){t.chrome="chrome",t.browser="browser"}(g||(g={})),t.cloneDeep=c,t.diffDeep=h,t.isEqual=f,t.mergeOrReplace=p,t.setupReduxed=function(t,e,r){var n=e||{},i=n.namespace,o=n.chromeNs,s=n.browserNs,a=n.storageArea,u=n.storageKey,c=n.isolated,f=n.plainActions,h=n.outdatedTimeout,p=r||{},l=p.onGlobalChange,b=p.onLocalChange,v=p.onError;if("function"!=typeof t)throw Error("Missing argument for 'storeCreatorContainer'");var _=s||i===g.browser?new S({namespace:s||browser,area:a,key:u}):new m({namespace:o||chrome,area:a,key:u});return"function"==typeof l&&_.regListener((function(e,r){var n=new d(t,_,!0,f),i=y(e)[0],o=y(r)[0];l(n.initFrom(i),o)})),c||_.regShared(),function(e){return v&&_.subscribeForError(v),new d(t,_,c,f,h,b,e).init()}},Object.defineProperty(t,"__esModule",{value:!0})}));
{
"name": "reduxed-chrome-storage",
"version": "3.0.0",
"version": "3.0.5",
"description": "Redux interface to chrome.storage (browser.storage). A unified way to use Redux in all modern browser extensions. The only way to get Redux working in Manifest V3 Chrome extensions",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -15,3 +15,3 @@ # Reduxed Chrome Storage

* [Tracking errors](#tracking-errors)
* [setupReduxed() function](#setupreduxed()-function)
* [setupReduxed() function](#setupreduxed-function)
* [Store creator container](#store-creator-container)

@@ -22,3 +22,3 @@ * [Options](#options)

* [Utility functions](#utility-functions)
* [How It Works / Caveats](#how-it-works-caveats)
* [How It Works / Caveats](#how-it-works--caveats)
* [JSON stringification of the state](#json-stringification-of-the-state)

@@ -25,0 +25,0 @@ * [Internal store, external state updates and outdated actions](#internal-store-external-state-updates-and-outdated-actions)

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