index.min.js 2.7 KB

12
  1. !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("lodash")):"function"==typeof define&&define.amd?define(["exports","lodash"],t):t((e=e||self).VuexPersistence={},e._)}(this,function(r,s){"use strict";var u=(e.prototype.enqueue=function(e){return this._queue.push(e),this._flushing?Promise.resolve():this.flushQueue()},e.prototype.flushQueue=function(){var t=this;this._flushing=!0;var r=function(){var e=t._queue.shift();if(e)return e.then(r);t._flushing=!1};return Promise.resolve(r())},e);function e(){this._queue=[],this._flushing=!1}function n(e,t){return s.merge({},e,t)}function t(e){var s=this;this._mutex=new u,this.subscriber=function(t){return function(e){return t.subscribe(e)}},void 0===e&&(e={}),this.key=null!=e.key?e.key:"vuex",this.subscribed=!1,this.supportCircular=e.supportCircular||!1,this.supportCircular&&(i=require("flatted"));var t=!0;try{window.localStorage.getItem("")}catch(e){t=!1}this.storage=e.storage||t&&window.localStorage||r.MockStorage&&new r.MockStorage,this.reducer=null!=e.reducer?e.reducer:null==e.modules?function(e){return e}:function(s){return e.modules.reduce(function(e,t){var r;return n(e,((r={})[t]=s[t],r))},{})},this.filter=e.filter||function(e){return!0},this.strictMode=e.strictMode||!1,this.RESTORE_MUTATION=function(e,t){for(var r=n(e,t||{}),s=0,u=Object.keys(r);s<u.length;s++){var i=u[s];this._vm.$set(e,i,r[i])}},this.asyncStorage=e.asyncStorage||!1,this.asyncStorage?(this.restoreState=null!=e.restoreState?e.restoreState:function(e,t){return t.getItem(e).then(function(e){return"string"==typeof e?s.supportCircular?i.parse(e||"{}"):JSON.parse(e||"{}"):e||{}})},this.saveState=null!=e.saveState?e.saveState:function(e,t,r){return r.setItem(e,s.asyncStorage?n({},t||{}):s.supportCircular?i.stringify(t):JSON.stringify(t))},this.plugin=function(t){t.restored=s.restoreState(s.key,s.storage).then(function(e){s.strictMode?t.commit("RESTORE_MUTATION",e):t.replaceState(n(t.state,e||{})),s.subscriber(t)(function(e,t){s.filter(e)&&s._mutex.enqueue(s.saveState(s.key,s.reducer(t),s.storage))}),s.subscribed=!0})}):(this.restoreState=null!=e.restoreState?e.restoreState:function(e,t){var r=t.getItem(e);return"string"==typeof r?s.supportCircular?i.parse(r||"{}"):JSON.parse(r||"{}"):r||{}},this.saveState=null!=e.saveState?e.saveState:function(e,t,r){return r.setItem(e,s.supportCircular?i.stringify(t):JSON.stringify(t))},this.plugin=function(e){var t=s.restoreState(s.key,s.storage);s.strictMode?e.commit("RESTORE_MUTATION",t):e.replaceState(n(e.state,t||{})),s.subscriber(e)(function(e,t){s.filter(e)&&s.saveState(s.key,s.reducer(t),s.storage)}),s.subscribed=!0})}var i=JSON;r.VuexPersistence=t,r.default=t,Object.defineProperty(r,"__esModule",{value:!0})});
  2. //# sourceMappingURL=index.min.js.map