1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const fetch_1 = require("../fetch");
|
4 | function 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 | }
|
16 | exports.fetch_no_cache = fetch_no_cache;
|
17 | exports.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 |
|
\ | No newline at end of file |