UNPKG

@difizen/mana-app

Version:

51 lines 4.34 kB
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); } var _dec, _dec2, _class, _class2, _descriptor; function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(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); } function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); } import { ApplicationContribution, localStorageService } from '@difizen/mana-core'; import { inject, singleton } from '@difizen/mana-syringe'; import { NotificationService } from "./notification/service"; import { jsx as _jsx } from "react/jsx-runtime"; export var ManaApplication = (_dec = singleton({ contrib: [ApplicationContribution] }), _dec2 = inject(NotificationService), _dec(_class = (_class2 = /*#__PURE__*/function () { function ManaApplication() { _classCallCheck(this, ManaApplication); _initializerDefineProperty(this, "notificationService", _descriptor, this); } _createClass(ManaApplication, [{ key: "initialize", value: function initialize() { var _this = this; localStorageService.onDiskQuotaExceeded(function () { var toDispose = _this.notificationService.info({ message: '浏览器缓存已满', description: /*#__PURE__*/_jsx("div", { children: "\u662F\u5426\u73B0\u5728\u6E05\u7406" }), actions: [{ key: 'confirm', label: '确认' }], onAction: function onAction() { localStorage.clear(); toDispose.dispose(); }, duration: null }); }); } }]); return ManaApplication; }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "notificationService", [_dec2], { configurable: true, enumerable: true, writable: true, initializer: null })), _class2)) || _class);