UNPKG

@sofaws/dapp-core

Version:

A library to hold the main logic for a dapp on the Elrond Network

3 lines (2 loc) 840 B
import{a as i}from"./chunk-ZU6LXEUO.js";import{a as l}from"./chunk-WTIKHG7D.js";import{e as n,g as p,m as a}from"./chunk-HBP5N4FR.js";var u={};p(u,{getItem:()=>c,localStorageKeys:()=>s,removeItem:()=>g,setItem:()=>y});var s,o,y,c,g,m=n(()=>{a();i();s={loginExpiresAt:"dapp-core-login-expires-at",logoutEvent:"dapp-core-logout-event"},o=typeof localStorage!="undefined",y=({key:t,data:r,expires:e})=>{!o||localStorage.setItem(String(t),JSON.stringify({expires:e,data:r}))},c=t=>{if(!o)return;let r=localStorage.getItem(String(t));if(!r)return null;let e=JSON.parse(r);return!e||!e.hasOwnProperty("expires")||!e.hasOwnProperty("data")?null:l()>=e.expires?(localStorage.removeItem(String(t)),null):e.data},g=t=>{!o||localStorage.removeItem(String(t))}});export{s as a,y as b,c,g as d,u as e,m as f}; //# sourceMappingURL=chunk-J6375EXR.js.map