Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/im/tools/localstorage/dist/ |
Upload File : |
this.BX=this.BX||{};(function(e){"use strict";var t=function(){function e(){babelHelpers.classCallCheck(this,e);this.enabled=null;this.expireList=null;this.expireInterval=null}babelHelpers.createClass(e,[{key:"isEnabled",value:function e(){if(this.enabled!==null){return this.enabled}this.enabled=false;if(typeof window.localStorage!=="undefined"){try{window.localStorage.setItem("__bx_test_ls_feature__","ok");if(window.localStorage.getItem("__bx_test_ls_feature__")==="ok"){window.localStorage.removeItem("__bx_test_ls_feature__");this.enabled=true}}catch(e){}}if(this.enabled&&!this.expireInterval){try{var t=window.localStorage.getItem("bx-messenger-localstorage-expire");if(t){this.expireList=JSON.parse(t)}}catch(e){}clearInterval(this.expireInterval);this.expireInterval=setInterval(this._checkExpireInterval.bind(this),6e4)}return this.enabled}},{key:"set",value:function e(t,i,r,n){var s=arguments.length>4&&arguments[4]!==undefined?arguments[4]:0;if(!this.isEnabled()){return false}var l=null;if(s){l=new Date((new Date).getTime()+s*1e3)}var a=JSON.stringify({value:n,expire:l});if(window.localStorage.getItem(this._getKey(t,i,r))!==a){window.localStorage.setItem(this._getKey(t,i,r),a)}if(s){if(!this.expireList){this.expireList={}}this.expireList[this._getKey(t,i,r)]=l;window.localStorage.setItem("bx-messenger-localstorage-expire",JSON.stringify(this.expireList))}return true}},{key:"get",value:function e(t,i,r,n){if(!this.isEnabled()){return typeof n!=="undefined"?n:null}var s=window.localStorage.getItem(this._getKey(t,i,r));if(s===null){return typeof n!=="undefined"?n:null}try{s=JSON.parse(s);if(s&&typeof s.value!=="undefined"){if(!s.expire||new Date(s.expire)>new Date){s=s.value}else{window.localStorage.removeItem(this._getKey(t,i,r));if(this.expireList){delete this.expireList[this._getKey(t,i,r)]}return typeof n!=="undefined"?n:null}}else{return typeof n!=="undefined"?n:null}}catch(e){return typeof n!=="undefined"?n:null}return s}},{key:"remove",value:function e(t,i,r){if(!this.isEnabled()){return false}if(this.expireList){delete this.expireList[this._getKey(t,i,r)]}return window.localStorage.removeItem(this._getKey(t,i,r))}},{key:"_getKey",value:function e(t,i,r){return"bx-messenger-"+t+"-"+i+"-"+r}},{key:"_checkExpireInterval",value:function e(){if(!this.expireList)return true;var t=new Date;var i=0;for(var r in this.expireList){if(!this.expireList.hasOwnProperty(r)){continue}if(new Date(this.expireList[r])<=t){window.localStorage.removeItem(r);delete this.expireList[r]}else{i++}}if(i){window.localStorage.setItem("bx-messenger-localstorage-expire",JSON.stringify(this.expireList))}else{this.expireList=null;window.localStorage.removeItem("bx-messenger-localstorage-expire")}return true}}]);return e}();var i=new t;e.LocalStorage=i})(this.BX.Messenger=this.BX.Messenger||{}); //# sourceMappingURL=localstorage.bundle.map.js