choerodon-ui
Version:
An enterprise-class UI design language and React-based implementation
53 lines (48 loc) • 1.25 kB
JavaScript
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _isPromise = _interopRequireDefault(require("is-promise"));
var now = Date.now();
var seed = 0;
var manager = {
config: {
duration: 4.5,
top: 24,
bottom: 24,
placement: 'topRight'
},
instances: new Map(),
remove: function remove(key) {
this.instances.forEach(function (instance) {
if ((0, _isPromise["default"])(instance)) {
instance.then(function (ins) {
return ins.removeNotice(key);
});
} else {
instance.removeNotice(key);
}
});
},
clear: function clear() {
var instances = this.instances;
instances.forEach(function (instance) {
if ((0, _isPromise["default"])(instance)) {
instance.then(function (ins) {
return ins.destroy();
});
} else {
instance.destroy();
}
});
instances.clear();
},
getUuid: function getUuid() {
return "c7nNotification_".concat(now, "_").concat(seed++);
}
};
var _default = manager;
exports["default"] = _default;
//# sourceMappingURL=index.js.map
;