@arc-publishing/sdk-sales
Version:
JS Sales SDK for working with Arc Subs Sales API
19 lines • 786 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ONGOING_FETCHES = void 0;
var constants_1 = require("../sdk/constants");
exports.ONGOING_FETCHES = new Set();
function SingletonFetch(url, options, methodName) {
if (options === void 0) { options = {}; }
if (!exports.ONGOING_FETCHES[methodName]) {
exports.ONGOING_FETCHES[methodName] = true;
return fetch(url, options).finally(function () {
exports.ONGOING_FETCHES[methodName] = false;
});
}
else {
return Promise.reject("".concat(constants_1.logPrefix, " ").concat(methodName, " cannot be called until the previous to ").concat(methodName, " completes"));
}
}
exports.default = SingletonFetch;
//# sourceMappingURL=SingletonFetch.js.map