UNPKG

@txdfe/at

Version:

一个设计体系组件库

54 lines (53 loc) 2.73 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CacheManager = void 0; var _CacheManager; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } var fullbackGlobal = {}; var CacheManager = exports.CacheManager = /*#__PURE__*/function () { function CacheManager() { _classCallCheck(this, CacheManager); } return _createClass(CacheManager, null, [{ key: "global", get: function get() { if (typeof globalThis !== 'undefined') { return globalThis; } if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return fullbackGlobal; } }, { key: "globalCache", get: function get() { if (typeof CacheManager.global._atIconScriptCaches !== 'undefined') { return CacheManager.global._atIconScriptCaches; } CacheManager.global._atIconScriptCaches = new Set(); return CacheManager.global._atIconScriptCaches; } }]); }(); _CacheManager = CacheManager; _defineProperty(CacheManager, "has", function (val) { return _CacheManager.globalCache.has(val); }); _defineProperty(CacheManager, "add", function (val) { return _CacheManager.globalCache.add(val); });