UNPKG

787 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.fetch_retry = exports.fetch_no_cache = void 0;
4const fetch_1 = require("../fetch");
5function fetch_no_cache(url, method = 'GET') {
6 const req = typeof Request === 'function' ? new Request(url) : url;
7 const headers = new Headers();
8 headers.append('pragma', 'no-cache');
9 headers.append('cache-control', 'no-cache');
10 const init = {
11 method,
12 cache: 'no-cache',
13 headers,
14 };
15 return fetch_1.fetch(req, init);
16}
17exports.fetch_no_cache = fetch_no_cache;
18exports.fetch_retry = (url, num_remain = 1, e) => num_remain <= 0
19 ? Promise.reject(e)
20 : fetch_1.fetch(url).catch(e => exports.fetch_retry(url, num_remain - 1, e));
21//# sourceMappingURL=network.js.map
\No newline at end of file