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