UNPKG

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