@biruni/capacitor-preferences
Version:
(Al-Biruni) @capacitor/preferences utility
1 lines • 1.11 kB
JavaScript
import{BiruniPlugin as e}from"@biruni/core/plugin";import{Preferences as r}from"@capacitor/preferences";var t,a=(e,r,t)=>{if(!r.has(e))throw TypeError("Cannot "+t)},s=(e,r,t)=>new Promise(((a,s)=>{var i=e=>{try{o(t.next(e))}catch(e){s(e)}},n=e=>{try{o(t.throw(e))}catch(e){s(e)}},o=e=>e.done?a(e.value):Promise.resolve(e.value).then(i,n);o((t=t.apply(e,r)).next())}));class i extends e{constructor(e){var i,n,o,c;super(),this.type="persister",this.name="capacitor/preferences",((e,r,t)=>{if(r.has(e))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(e):r.set(e,t)})(this,t,void 0),this.preprocess=()=>s(this,null,(function*(){return(yield r.get({key:this.namespace})).value})),this.postprocess=e=>s(this,null,(function*(){return yield r.set({key:this.name,value:e}),e})),o=r,a(i=this,n=t,"write to private field"),c?c.call(i,o):n.set(i,o),e&&((e,r,t)=>(a(e,r,"read from private field"),t?t.call(e):r.get(e)))(this,t).configure(e)}}t=new WeakMap;const n=e=>new i(e);var o=n;export{n as PreferencesPlugin,o as default,n as preferences};//# sourceMappingURL=mod.js.map