@beenotung/tslib
Version:
utils library in Typescript
21 lines • 787 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.fetch_retry = exports.fetch_no_cache = void 0;
const fetch_1 = require("../fetch");
function fetch_no_cache(url, method = 'GET') {
const req = typeof Request === 'function' ? new Request(url) : url;
const headers = new Headers();
headers.append('pragma', 'no-cache');
headers.append('cache-control', 'no-cache');
const init = {
method,
cache: 'no-cache',
headers,
};
return fetch_1.fetch(req, init);
}
exports.fetch_no_cache = fetch_no_cache;
exports.fetch_retry = (url, num_remain = 1, e) => num_remain <= 0
? Promise.reject(e)
: fetch_1.fetch(url).catch(e => exports.fetch_retry(url, num_remain - 1, e));
//# sourceMappingURL=network.js.map