choerodon-ui
Version:
An enterprise-class UI design language and React-based implementation
56 lines (40 loc) • 1.46 kB
JavaScript
;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = exports.AttachmentStore = void 0;
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _configure = require("../../../lib/configure");
var _PromiseMerger = _interopRequireDefault(require("../_util/PromiseMerger"));
var AttachmentStore =
/*#__PURE__*/
function () {
function AttachmentStore() {
(0, _classCallCheck2["default"])(this, AttachmentStore);
this.batchCallback = function (uuids) {
var _getConfig = (0, _configure.getConfig)('attachment'),
batchFetchCount = _getConfig.batchFetchCount;
if (batchFetchCount) {
return batchFetchCount(uuids);
}
return Promise.resolve({});
};
this.merger = new _PromiseMerger["default"](this.batchCallback, {
maxAge: 60000,
max: 100
});
}
(0, _createClass2["default"])(AttachmentStore, [{
key: "fetchCountInBatch",
value: function fetchCountInBatch(uuid) {
return this.merger.add(uuid);
}
}]);
return AttachmentStore;
}();
exports.AttachmentStore = AttachmentStore;
var _default = new AttachmentStore();
exports["default"] = _default;
//# sourceMappingURL=AttachmentStore.js.map