@naturalcycles/js-lib 14.123.1 → 14.123.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/http/fetcher.js +3 -0
- package/dist-esm/http/fetcher.js +3 -0
- package/package.json +1 -1
- package/src/http/fetcher.ts +4 -0
package/dist/http/fetcher.js
CHANGED
|
@@ -24,6 +24,9 @@ const defRetryOptions = {
|
|
|
24
24
|
*/
|
|
25
25
|
class Fetcher {
|
|
26
26
|
constructor(cfg = {}) {
|
|
27
|
+
if (typeof globalThis.fetch !== 'function') {
|
|
28
|
+
throw new TypeError(`globalThis.fetch is not available`);
|
|
29
|
+
}
|
|
27
30
|
this.cfg = this.normalizeCfg(cfg);
|
|
28
31
|
// Dynamically create all helper methods
|
|
29
32
|
http_model_1.HTTP_METHODS.forEach(method => {
|
package/dist-esm/http/fetcher.js
CHANGED
|
@@ -22,6 +22,9 @@ const defRetryOptions = {
|
|
|
22
22
|
*/
|
|
23
23
|
export class Fetcher {
|
|
24
24
|
constructor(cfg = {}) {
|
|
25
|
+
if (typeof globalThis.fetch !== 'function') {
|
|
26
|
+
throw new TypeError(`globalThis.fetch is not available`);
|
|
27
|
+
}
|
|
25
28
|
this.cfg = this.normalizeCfg(cfg);
|
|
26
29
|
// Dynamically create all helper methods
|
|
27
30
|
HTTP_METHODS.forEach(method => {
|
package/package.json
CHANGED
package/src/http/fetcher.ts
CHANGED
|
@@ -187,6 +187,10 @@ const defRetryOptions: FetcherRetryOptions = {
|
|
|
187
187
|
*/
|
|
188
188
|
export class Fetcher {
|
|
189
189
|
private constructor(cfg: FetcherCfg & FetcherOptions = {}) {
|
|
190
|
+
if (typeof globalThis.fetch !== 'function') {
|
|
191
|
+
throw new TypeError(`globalThis.fetch is not available`)
|
|
192
|
+
}
|
|
193
|
+
|
|
190
194
|
this.cfg = this.normalizeCfg(cfg)
|
|
191
195
|
|
|
192
196
|
// Dynamically create all helper methods
|