pinia-plugin-persist-uni
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -1,2 +0,2 @@ | ||
const isH5 = !uni.getSystemInfoSync().version; | ||
const isH5 = window; | ||
const updateStorage = (strategy, store) => { | ||
@@ -3,0 +3,0 @@ const storage = strategy.storage; |
@@ -1,1 +0,1 @@ | ||
(function(s,i){typeof exports=="object"&&typeof module!="undefined"?i(exports):typeof define=="function"&&define.amd?define(["exports"],i):(s=typeof globalThis!="undefined"?globalThis:s||self,i(s.piniaPersist={}))})(this,function(s){"use strict";const i=!uni.getSystemInfoSync().version,g=(t,e)=>{const n=t.storage,a=t.key||e.$id;if(t.paths){const r=t.paths.reduce((o,d)=>(o[d]=e.$state[d],o),{});i&&n?n.setItem(a,JSON.stringify(r)):uni.setStorage({key:a,data:JSON.stringify(r)})}else i&&n?n.setItem(a,JSON.stringify(e.$state)):uni.setStorage({key:a,data:JSON.stringify(e.$state)})};var p=({options:t,store:e})=>{var n,a,r,o,d;if((n=t.persist)!=null&&n.enabled){const y=[{key:e.$id,storage:((a=t.persist)==null?void 0:a.H5Storage)||(window==null?void 0:window.sessionStorage)}],S=(o=(r=t.persist)==null?void 0:r.strategies)!=null&&o.length?(d=t.persist)==null?void 0:d.strategies:y;S.forEach(f=>{var l;const h=f.storage||((l=t.persist)==null?void 0:l.H5Storage)||(window==null?void 0:window.sessionStorage),c=f.key||e.$id;let u;i?u=h.getItem(c):u=uni.getStorageSync(c),u&&(e.$patch(JSON.parse(u)),g(f,e))}),e.$subscribe(()=>{S.forEach(f=>{g(f,e)})})}};s.default=p,s.updateStorage=g,Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); | ||
(function(s,i){typeof exports=="object"&&typeof module!="undefined"?i(exports):typeof define=="function"&&define.amd?define(["exports"],i):(s=typeof globalThis!="undefined"?globalThis:s||self,i(s.piniaPersist={}))})(this,function(s){"use strict";const i=window,g=(t,e)=>{const a=t.storage,n=t.key||e.$id;if(t.paths){const r=t.paths.reduce((o,d)=>(o[d]=e.$state[d],o),{});i&&a?a.setItem(n,JSON.stringify(r)):uni.setStorage({key:n,data:JSON.stringify(r)})}else i&&a?a.setItem(n,JSON.stringify(e.$state)):uni.setStorage({key:n,data:JSON.stringify(e.$state)})};var p=({options:t,store:e})=>{var a,n,r,o,d;if((a=t.persist)!=null&&a.enabled){const h=[{key:e.$id,storage:((n=t.persist)==null?void 0:n.H5Storage)||(window==null?void 0:window.sessionStorage)}],c=(o=(r=t.persist)==null?void 0:r.strategies)!=null&&o.length?(d=t.persist)==null?void 0:d.strategies:h;c.forEach(f=>{var l;const y=f.storage||((l=t.persist)==null?void 0:l.H5Storage)||(window==null?void 0:window.sessionStorage),S=f.key||e.$id;let u;i?u=y.getItem(S):u=uni.getStorageSync(S),u&&(e.$patch(JSON.parse(u)),g(f,e))}),e.$subscribe(()=>{c.forEach(f=>{g(f,e)})})}};s.default=p,s.updateStorage=g,Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); |
{ | ||
"name": "pinia-plugin-persist-uni", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |
9826